okozachenko1203 | 85370ca | 2023-03-24 23:16:18 +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_data }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_manila_data := .Values.pod.mounts.manila_data.manila_data }} |
| 19 | {{- $mounts_manila_data_init := .Values.pod.mounts.manila_data.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "manila-data" }} |
| 22 | {{ tuple $envAll "data" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 27 | name: manila-data |
| 28 | annotations: |
| 29 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 30 | labels: |
| 31 | {{ tuple $envAll "manila" "data" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 32 | spec: |
| 33 | replicas: {{ .Values.pod.replicas.data }} |
| 34 | selector: |
| 35 | matchLabels: |
| 36 | {{ tuple $envAll "manila" "data" | 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" "data" | 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-data" "containerNames" (list "init" "manila-data") | 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 }} |
| 49 | serviceAccountName: {{ $serviceAccountName }} |
| 50 | affinity: |
| 51 | {{ tuple $envAll "manila" "data" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 52 | nodeSelector: |
| 53 | {{ .Values.labels.data.node_selector_key }}: {{ .Values.labels.data.node_selector_value }} |
| 54 | {{ if $envAll.Values.pod.tolerations.manila.enabled }} |
| 55 | {{ tuple $envAll "manila" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 56 | {{ end }} |
| 57 | initContainers: |
| 58 | {{ tuple $envAll "data" $mounts_manila_data_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 59 | containers: |
| 60 | - name: manila-data |
| 61 | {{ tuple $envAll "manila_data" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 62 | {{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 63 | {{ dict "envAll" $envAll "application" "manila" "container" "manila_data" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 64 | command: |
| 65 | - /tmp/manila-data.sh |
| 66 | env: |
| 67 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 68 | - name: REQUESTS_CA_BUNDLE |
| 69 | value: "/etc/manila/certs/ca.crt" |
| 70 | {{- end }} |
| 71 | volumeMounts: |
| 72 | - name: pod-tmp |
| 73 | mountPath: /tmp |
| 74 | - name: etcmanila |
| 75 | mountPath: /etc/manila |
| 76 | - name: state-tmp |
| 77 | mountPath: /var/lib/manila |
| 78 | - name: manila-etc |
| 79 | mountPath: /etc/manila/manila.conf |
| 80 | subPath: manila.conf |
| 81 | readOnly: true |
| 82 | {{- if .Values.conf.manila.DEFAULT.log_config_append }} |
| 83 | - name: manila-etc |
| 84 | mountPath: {{ .Values.conf.manila.DEFAULT.log_config_append }} |
| 85 | subPath: {{ base .Values.conf.manila.DEFAULT.log_config_append }} |
| 86 | readOnly: true |
| 87 | {{- end }} |
| 88 | - name: manila-etc |
| 89 | mountPath: /etc/manila/policy.yaml |
| 90 | subPath: policy.yaml |
| 91 | readOnly: true |
| 92 | - name: manila-bin |
| 93 | mountPath: /tmp/manila-data.sh |
| 94 | subPath: manila-data.sh |
| 95 | readOnly: true |
| 96 | {{- 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 }} |
| 97 | {{- 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 }} |
| 98 | {{- 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 }} |
| 99 | |
| 100 | {{ if $mounts_manila_data.volumeMounts }}{{ toYaml $mounts_manila_data.volumeMounts | indent 12 }}{{ end }} |
| 101 | volumes: |
| 102 | - name: pod-tmp |
| 103 | emptyDir: {} |
| 104 | - name: state-tmp |
| 105 | emptyDir: {} |
| 106 | - name: etcmanila |
| 107 | emptyDir: {} |
| 108 | - name: manila-etc |
| 109 | secret: |
| 110 | secretName: manila-etc |
| 111 | defaultMode: 0444 |
| 112 | - name: manila-bin |
| 113 | configMap: |
| 114 | name: manila-bin |
| 115 | defaultMode: 0555 |
| 116 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 117 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 118 | {{- 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 }} |
| 119 | |
| 120 | {{ if $mounts_manila_data.volumes }}{{ toYaml $mounts_manila_data.volumes | indent 8 }}{{ end }} |
| 121 | {{- end }} |