blob: 87bff3b11e66926b5b3df3c08895412d01c51622 [file] [log] [blame]
okozachenko120361008f72023-03-23 21:21:09 +11001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations under the License.
13*/}}
14
15{{- if .Values.manifests.deployment_share }}
16{{- $envAll := . }}
17
18{{- $mounts_manila_share := .Values.pod.mounts.manila_share.manila_share }}
19{{- $mounts_manila_share_init := .Values.pod.mounts.manila_share.init_container }}
20
21{{- $serviceAccountName := "manila-share" }}
22{{ tuple $envAll "share" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: manila-share
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "manila" "share" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.share }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "manila" "share" | 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" "share" | 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" }}
Rico Lin59516f62023-10-04 23:25:47 +080046{{ dict "envAll" $envAll "podName" "manila-share" "containerNames" (list "init" "manila-share" "manila-share-init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
okozachenko120361008f72023-03-23 21:21:09 +110047 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" "share" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
52 nodeSelector:
53 {{ .Values.labels.share.node_selector_key }}: {{ .Values.labels.share.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 dnsPolicy: ClusterFirstWithHostNet
58 hostNetwork: true
59 initContainers:
60{{ tuple $envAll "share" $mounts_manila_share_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
Rico Lin59516f62023-10-04 23:25:47 +080061 - name: manila-share-init
62{{ tuple $envAll "manila_share" | include "helm-toolkit.snippets.image" | indent 10 }}
63{{ dict "envAll" $envAll "application" "manila" "container" "manila_share" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
64 env: []
65 command:
66 - /tmp/manila-share-init.sh
67 volumeMounts:
68 - name: pod-tmp
69 mountPath: /tmp
70 - name: manila-bin
71 mountPath: /tmp/manila-share-init.sh
72 subPath: manila-share-init.sh
73 readOnly: true
74 - name: pod-shared
75 mountPath: /tmp/pod-shared
76{{ if $mounts_manila_share.volumeMounts }}{{ toYaml $mounts_manila_share.volumeMounts | indent 12 }}{{ end }}
okozachenko120361008f72023-03-23 21:21:09 +110077 containers:
78 - name: manila-share
79{{ tuple $envAll "manila_share" | include "helm-toolkit.snippets.image" | indent 10 }}
80{{ tuple $envAll $envAll.Values.pod.resources.share | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
81{{ dict "envAll" $envAll "application" "manila" "container" "manila_share" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
82 command:
83 - /tmp/manila-share.sh
84 env:
85{{- if or .Values.manifests.certificates .Values.tls.identity }}
86 - name: REQUESTS_CA_BUNDLE
87 value: "/etc/manila/certs/ca.crt"
88{{- end }}
89 volumeMounts:
90 - name: pod-tmp
91 mountPath: /tmp
Rico Lin59516f62023-10-04 23:25:47 +080092 - name: pod-shared
93 mountPath: /tmp/pod-shared
okozachenko120361008f72023-03-23 21:21:09 +110094 - name: etcmanila
95 mountPath: /etc/manila
96 - name: state-tmp
97 mountPath: /var/lib/manila
98 - name: manila-etc
99 mountPath: /etc/manila/manila.conf
100 subPath: manila.conf
101 readOnly: true
102 - name: manila-etc
103 mountPath: /etc/manila/rootwrap.conf
104 subPath: rootwrap.conf
105 - name: manila-etc
106 mountPath: /etc/sudoers.d/kolla_manila_sudoers
107 subPath: manila_sudoers
108 readOnly: true
109 - name: manila-etc
110 mountPath: /etc/sudoers.d/kolla_manila_volume_sudoers
111 subPath: manila_sudoers
112 readOnly: true
113 - mountPath: /run/openvswitch
114 name: run-openvswitch
115 readOnly: true
116 {{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
117 {{- if ( has "share" $value.pods ) }}
118 {{- $filePrefix := replace "_" "-" $key }}
119 {{- $rootwrapFile := printf "/etc/manila/rootwrap.d/%s.filters" $filePrefix }}
120 - name: manila-etc
121 mountPath: {{ $rootwrapFile }}
122 subPath: {{ base $rootwrapFile }}
123 readOnly: true
124 {{- end }}
125 {{- end }}
126 {{- if .Values.conf.manila.DEFAULT.log_config_append }}
127 - name: manila-etc
128 mountPath: {{ .Values.conf.manila.DEFAULT.log_config_append }}
129 subPath: {{ base .Values.conf.manila.DEFAULT.log_config_append }}
130 readOnly: true
131 {{- end }}
132 - name: manila-etc
133 mountPath: /etc/manila/policy.yaml
134 subPath: policy.yaml
135 readOnly: true
136 - name: manila-bin
137 mountPath: /tmp/manila-share.sh
138 subPath: manila-share.sh
139 readOnly: true
140{{- 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 }}
141{{- 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 }}
142{{- 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 }}
143
144{{ if $mounts_manila_share.volumeMounts }}{{ toYaml $mounts_manila_share.volumeMounts | indent 12 }}{{ end }}
145 volumes:
146 - name: pod-tmp
147 emptyDir: {}
Rico Lin59516f62023-10-04 23:25:47 +0800148 - name: pod-shared
149 emptyDir: {}
okozachenko120361008f72023-03-23 21:21:09 +1100150 - name: state-tmp
151 emptyDir: {}
152 - name: etcmanila
153 emptyDir: {}
154 - name: run-openvswitch
155 hostPath:
156 path: /run/openvswitch
157 type: Directory
158 - name: manila-etc
159 secret:
160 secretName: manila-etc
161 defaultMode: 0444
162 - name: manila-bin
163 configMap:
164 name: manila-bin
165 defaultMode: 0555
166{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
167{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
168{{- 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 }}
169
170{{ if $mounts_manila_share.volumes }}{{ toYaml $mounts_manila_share.volumes | indent 8 }}{{ end }}
171{{- end }}