blob: bcc352f0d76f7881cf467518cdefb62d8de3edd4 [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_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---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
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 }}
32spec:
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 }}
49 serviceAccountName: {{ $serviceAccountName }}
50 affinity:
51{{ tuple $envAll "manila" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
52 nodeSelector:
53 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.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 "api" $mounts_manila_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
59 containers:
60 - name: manila-api
61{{ tuple $envAll "manila_api" | include "helm-toolkit.snippets.image" | indent 10 }}
62{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
63{{ dict "envAll" $envAll "application" "manila" "container" "manila_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
64 command:
65 - /tmp/manila-api.sh
66 - start
67 env:
68{{- if or .Values.manifests.certificates .Values.tls.identity }}
69 - name: REQUESTS_CA_BUNDLE
70 value: "/etc/manila/certs/ca.crt"
71{{- end }}
72 lifecycle:
73 preStop:
74 exec:
75 command:
76 - /tmp/manila-api.sh
77 - stop
78 ports:
79 - name: m-api
80 containerPort: {{ tuple "share" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
81 readinessProbe:
82 httpGet:
83 scheme: HTTP
84 path: /
85 port: {{ tuple "share" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
86 volumeMounts:
87 - name: pod-tmp
88 mountPath: /tmp
89 - name: state-tmp
90 mountPath: /var/lib/manila
91 - name: etcmanila
92 mountPath: /etc/manila
93 - name: manila-etc
94 mountPath: /etc/manila/manila.conf
95 subPath: manila.conf
96 readOnly: true
Oleksandr Kozachenko103c85e2023-10-04 17:39:45 +020097 - name: manila-etc
98 mountPath: /etc/manila/manila-api-uwsgi.ini
99 subPath: manila-api-uwsgi.ini
100 readOnly: true
okozachenko120361008f72023-03-23 21:21:09 +1100101 {{- if .Values.conf.manila.DEFAULT.log_config_append }}
102 - name: manila-etc
103 mountPath: {{ .Values.conf.manila.DEFAULT.log_config_append }}
104 subPath: {{ base .Values.conf.manila.DEFAULT.log_config_append }}
105 readOnly: true
106 {{- end }}
Rico Lin59516f62023-10-04 23:25:47 +0800107 {{- if .Values.conf.paste }}
okozachenko120361008f72023-03-23 21:21:09 +1100108 - name: manila-etc
109 mountPath: /etc/manila/api-paste.ini
110 subPath: api-paste.ini
111 readOnly: true
Rico Lin59516f62023-10-04 23:25:47 +0800112 {{- end }}
okozachenko120361008f72023-03-23 21:21:09 +1100113 - name: manila-etc
114 mountPath: /etc/manila/policy.yaml
115 subPath: policy.yaml
116 readOnly: true
117 - name: manila-bin
118 mountPath: /tmp/manila-api.sh
119 subPath: manila-api.sh
120 readOnly: true
121{{- 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 }}
122{{- 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 }}
123{{- 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 }}
124
125{{ if $mounts_manila_api.volumeMounts }}{{ toYaml $mounts_manila_api.volumeMounts | indent 12 }}{{ end }}
126 volumes:
127 - name: pod-tmp
128 emptyDir: {}
129 - name: state-tmp
130 emptyDir: {}
131 - name: etcmanila
132 emptyDir: {}
133 - name: manila-etc
134 secret:
135 secretName: manila-etc
136 defaultMode: 0444
137 - name: manila-bin
138 configMap:
139 name: manila-bin
140 defaultMode: 0555
141{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
142{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
143{{- 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 }}
144
145{{ if $mounts_manila_api.volumes }}{{ toYaml $mounts_manila_api.volumes | indent 8 }}{{ end }}
146{{- end }}