blob: 0338ee177efd3e906998ae174842acfca426c92e [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 }}
Dong Maf1596772025-02-11 05:18:42 +000049{{ with .Values.pod.priorityClassName.manila_api }}
50 priorityClassName: {{ . }}
51{{ end }}
52{{ with .Values.pod.runtimeClassName.manila_api }}
53 runtimeClassName: {{ . }}
54{{ end }}
okozachenko120361008f72023-03-23 21:21:09 +110055 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 Kozachenko103c85e2023-10-04 17:39:45 +0200103 - name: manila-etc
104 mountPath: /etc/manila/manila-api-uwsgi.ini
105 subPath: manila-api-uwsgi.ini
106 readOnly: true
okozachenko120361008f72023-03-23 21:21:09 +1100107 {{- 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 Lin59516f62023-10-04 23:25:47 +0800113 {{- if .Values.conf.paste }}
okozachenko120361008f72023-03-23 21:21:09 +1100114 - name: manila-etc
115 mountPath: /etc/manila/api-paste.ini
116 subPath: api-paste.ini
117 readOnly: true
Rico Lin59516f62023-10-04 23:25:47 +0800118 {{- end }}
okozachenko120361008f72023-03-23 21:21:09 +1100119 - 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 }}