okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [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_manila_api := .Values.pod.mounts.manila_api.manila_api }} |
| 19 | {{- $mounts_manila_api_init := .Values.pod.mounts.manila_api.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "manila-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: manila-api |
| 28 | annotations: |
| 29 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 30 | labels: |
| 31 | {{ tuple $envAll "manila" "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 "manila" "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 "manila" "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 | {{ dict "envAll" $envAll "podName" "manila-api" "containerNames" (list "init" "manila-api") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 47 | spec: |
| 48 | {{ dict "envAll" $envAll "application" "manila" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 49 | {{ with .Values.pod.priorityClassName.manila_api }} |
| 50 | priorityClassName: {{ . }} |
| 51 | {{ end }} |
| 52 | {{ with .Values.pod.runtimeClassName.manila_api }} |
| 53 | runtimeClassName: {{ . }} |
| 54 | {{ end }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 55 | serviceAccountName: {{ $serviceAccountName }} |
| 56 | affinity: |
| 57 | {{ tuple $envAll "manila" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 58 | nodeSelector: |
| 59 | {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} |
| 60 | {{ if $envAll.Values.pod.tolerations.manila.enabled }} |
| 61 | {{ tuple $envAll "manila" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 62 | {{ end }} |
| 63 | initContainers: |
| 64 | {{ tuple $envAll "api" $mounts_manila_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 65 | containers: |
| 66 | - name: manila-api |
| 67 | {{ tuple $envAll "manila_api" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 68 | {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 69 | {{ dict "envAll" $envAll "application" "manila" "container" "manila_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 70 | command: |
| 71 | - /tmp/manila-api.sh |
| 72 | - start |
| 73 | env: |
| 74 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 75 | - name: REQUESTS_CA_BUNDLE |
| 76 | value: "/etc/manila/certs/ca.crt" |
| 77 | {{- end }} |
| 78 | lifecycle: |
| 79 | preStop: |
| 80 | exec: |
| 81 | command: |
| 82 | - /tmp/manila-api.sh |
| 83 | - stop |
| 84 | ports: |
| 85 | - name: m-api |
| 86 | containerPort: {{ tuple "share" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 87 | readinessProbe: |
| 88 | httpGet: |
| 89 | scheme: HTTP |
| 90 | path: / |
| 91 | port: {{ tuple "share" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 92 | volumeMounts: |
| 93 | - name: pod-tmp |
| 94 | mountPath: /tmp |
| 95 | - name: state-tmp |
| 96 | mountPath: /var/lib/manila |
| 97 | - name: etcmanila |
| 98 | mountPath: /etc/manila |
| 99 | - name: manila-etc |
| 100 | mountPath: /etc/manila/manila.conf |
| 101 | subPath: manila.conf |
| 102 | readOnly: true |
Oleksandr Kozachenko | 103c85e | 2023-10-04 17:39:45 +0200 | [diff] [blame] | 103 | - name: manila-etc |
| 104 | mountPath: /etc/manila/manila-api-uwsgi.ini |
| 105 | subPath: manila-api-uwsgi.ini |
| 106 | readOnly: true |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 107 | {{- if .Values.conf.manila.DEFAULT.log_config_append }} |
| 108 | - name: manila-etc |
| 109 | mountPath: {{ .Values.conf.manila.DEFAULT.log_config_append }} |
| 110 | subPath: {{ base .Values.conf.manila.DEFAULT.log_config_append }} |
| 111 | readOnly: true |
| 112 | {{- end }} |
Rico Lin | 59516f6 | 2023-10-04 23:25:47 +0800 | [diff] [blame] | 113 | {{- if .Values.conf.paste }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 114 | - name: manila-etc |
| 115 | mountPath: /etc/manila/api-paste.ini |
| 116 | subPath: api-paste.ini |
| 117 | readOnly: true |
Rico Lin | 59516f6 | 2023-10-04 23:25:47 +0800 | [diff] [blame] | 118 | {{- end }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 119 | - name: manila-etc |
| 120 | mountPath: /etc/manila/policy.yaml |
| 121 | subPath: policy.yaml |
| 122 | readOnly: true |
| 123 | - name: manila-bin |
| 124 | mountPath: /tmp/manila-api.sh |
| 125 | subPath: manila-api.sh |
| 126 | readOnly: true |
| 127 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 128 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.share.api.internal "path" "/etc/manila/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 129 | {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 130 | |
| 131 | {{ if $mounts_manila_api.volumeMounts }}{{ toYaml $mounts_manila_api.volumeMounts | indent 12 }}{{ end }} |
| 132 | volumes: |
| 133 | - name: pod-tmp |
| 134 | emptyDir: {} |
| 135 | - name: state-tmp |
| 136 | emptyDir: {} |
| 137 | - name: etcmanila |
| 138 | emptyDir: {} |
| 139 | - name: manila-etc |
| 140 | secret: |
| 141 | secretName: manila-etc |
| 142 | defaultMode: 0444 |
| 143 | - name: manila-bin |
| 144 | configMap: |
| 145 | name: manila-bin |
| 146 | defaultMode: 0555 |
| 147 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 148 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 149 | {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 150 | |
| 151 | {{ if $mounts_manila_api.volumes }}{{ toYaml $mounts_manila_api.volumes | indent 8 }}{{ end }} |
| 152 | {{- end }} |