Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | */}} |
| 14 | |
| 15 | {{- if .Values.manifests.deployment_api }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_magnum_api := .Values.pod.mounts.magnum_api.magnum_api }} |
| 19 | {{- $mounts_magnum_api_init := .Values.pod.mounts.magnum_api.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "magnum-api" }} |
| 22 | {{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 27 | name: magnum-api |
| 28 | annotations: |
| 29 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 30 | labels: |
| 31 | {{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 32 | spec: |
| 33 | replicas: {{ .Values.pod.replicas.api }} |
| 34 | selector: |
| 35 | matchLabels: |
| 36 | {{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 37 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 38 | template: |
| 39 | metadata: |
| 40 | labels: |
| 41 | {{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 42 | annotations: |
| 43 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 44 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 45 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 46 | spec: |
Dong Ma | 7fa5c2a | 2025-02-10 15:37:34 +0000 | [diff] [blame] | 47 | {{ with .Values.pod.priorityClassName.magnum_api }} |
| 48 | priorityClassName: {{ . }} |
| 49 | {{ end }} |
| 50 | {{ with .Values.pod.runtimeClassName.magnum_api }} |
| 51 | runtimeClassName: {{ . }} |
| 52 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 53 | serviceAccountName: {{ $serviceAccountName }} |
| 54 | affinity: |
| 55 | {{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 56 | nodeSelector: |
| 57 | {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} |
| 58 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} |
| 59 | initContainers: |
| 60 | {{ tuple $envAll "api" $mounts_magnum_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 61 | containers: |
| 62 | - name: magnum-api |
| 63 | {{ tuple $envAll "magnum_api" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 64 | {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 65 | securityContext: |
| 66 | runAsUser: {{ .Values.pod.user.magnum.uid }} |
| 67 | command: |
| 68 | - /tmp/magnum-api.sh |
| 69 | - start |
| 70 | lifecycle: |
| 71 | preStop: |
| 72 | exec: |
| 73 | command: |
| 74 | - /tmp/magnum-api.sh |
| 75 | - stop |
| 76 | ports: |
| 77 | - name: m-api |
| 78 | containerPort: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 79 | readinessProbe: |
| 80 | httpGet: |
| 81 | scheme: HTTP |
| 82 | path: / |
| 83 | port: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Oleksandr Kozachenko | 878891e | 2023-10-04 17:36:30 +0200 | [diff] [blame] | 84 | initialDelaySeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 85 | periodSeconds: 10 |
| 86 | volumeMounts: |
| 87 | - name: pod-tmp |
| 88 | mountPath: /tmp |
| 89 | - name: magnum-bin |
| 90 | mountPath: /tmp/magnum-api.sh |
| 91 | subPath: magnum-api.sh |
| 92 | readOnly: true |
| 93 | - name: pod-etc-magnum |
| 94 | mountPath: /etc/magnum |
| 95 | - name: pod-var-cache-magnum |
| 96 | mountPath: /var/cache/magnum |
| 97 | - name: magnum-etc |
| 98 | mountPath: /etc/magnum/magnum.conf |
| 99 | subPath: magnum.conf |
| 100 | readOnly: true |
Oleksandr Kozachenko | 878891e | 2023-10-04 17:36:30 +0200 | [diff] [blame] | 101 | - name: magnum-etc |
| 102 | mountPath: /etc/magnum/magnum-api-uwsgi.ini |
| 103 | subPath: magnum-api-uwsgi.ini |
| 104 | readOnly: true |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 105 | {{- if .Values.conf.magnum.DEFAULT.log_config_append }} |
| 106 | - name: magnum-etc |
| 107 | mountPath: {{ .Values.conf.magnum.DEFAULT.log_config_append }} |
| 108 | subPath: {{ base .Values.conf.magnum.DEFAULT.log_config_append }} |
| 109 | readOnly: true |
| 110 | {{- end }} |
| 111 | - name: magnum-etc |
| 112 | mountPath: /etc/magnum/api-paste.ini |
| 113 | subPath: api-paste.ini |
| 114 | readOnly: true |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 115 | - name: magnum-etc |
| 116 | mountPath: /etc/magnum/policy.yaml |
| 117 | subPath: policy.yaml |
| 118 | readOnly: true |
| 119 | - name: magnum-lock-path |
| 120 | mountPath: {{ .Values.conf.magnum.oslo_concurrency.lock_path }} |
| 121 | {{ if $mounts_magnum_api.volumeMounts }}{{ toYaml $mounts_magnum_api.volumeMounts | indent 12 }}{{ end }} |
| 122 | volumes: |
| 123 | - name: pod-tmp |
| 124 | emptyDir: {} |
| 125 | - name: pod-etc-magnum |
| 126 | emptyDir: {} |
| 127 | - name: pod-var-cache-magnum |
| 128 | emptyDir: {} |
| 129 | - name: magnum-bin |
| 130 | configMap: |
| 131 | name: magnum-bin |
| 132 | defaultMode: 0555 |
| 133 | - name: magnum-etc |
| 134 | secret: |
| 135 | secretName: magnum-etc |
| 136 | defaultMode: 0444 |
| 137 | - name: magnum-lock-path |
| 138 | emptyDir: {} |
| 139 | {{ if $mounts_magnum_api.volumes }}{{ toYaml $mounts_magnum_api.volumes | indent 8 }}{{ end }} |
| 140 | {{- end }} |