blob: feab3ef7386e7e2a2b3c66f9e802c9fb115d86f1 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
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_cinder_api := .Values.pod.mounts.cinder_api.cinder_api }}
19{{- $mounts_cinder_api_init := .Values.pod.mounts.cinder_api.init_container }}
20
21{{- $serviceAccountName := "cinder-api" }}
22{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: cinder-api
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.api }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "cinder" "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 "cinder" "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" "cinder-api" "containerNames" (list "cinder-api" "ceph-coordination-volume-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
47 spec:
48 serviceAccountName: {{ $serviceAccountName }}
49{{ dict "envAll" $envAll "application" "cinder_api" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
50 affinity:
51{{ tuple $envAll "cinder" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
52{{ if $envAll.Values.pod.tolerations.cinder.enabled }}
53{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
54{{ end }}
55 nodeSelector:
56 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
57 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
58 initContainers:
59{{ tuple $envAll "api" $mounts_cinder_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
60 {{- if eq ( split "://" .Values.conf.cinder.coordination.backend_url )._0 "file" }}
61 - name: ceph-coordination-volume-perms
62{{ tuple $envAll "cinder_api" | include "helm-toolkit.snippets.image" | indent 10 }}
63{{ dict "envAll" $envAll "application" "cinder_api" "container" "ceph_coordination_volume_perms" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
64 command:
65 - chown
66 - -R
67 - "cinder:"
68 - {{ ( split "://" .Values.conf.cinder.coordination.backend_url )._1 }}
69 volumeMounts:
70 - name: pod-tmp
71 mountPath: /tmp
72 - name: cinder-coordination
73 mountPath: {{ ( split "://" .Values.conf.cinder.coordination.backend_url )._1 }}
74 {{ end }}
75 containers:
76 - name: cinder-api
77{{ tuple $envAll "cinder_api" | include "helm-toolkit.snippets.image" | indent 10 }}
78{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
79{{ dict "envAll" $envAll "application" "cinder_api" "container" "cinder_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
80 command:
81 - /tmp/cinder-api.sh
82 - start
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000083 env:
84{{- if or .Values.manifests.certificates .Values.tls.identity }}
85 - name: REQUESTS_CA_BUNDLE
86 value: "/etc/cinder/certs/ca.crt"
87{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050088 lifecycle:
89 preStop:
90 exec:
91 command:
92 - /tmp/cinder-api.sh
93 - stop
94 ports:
95 - name: c-api
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010096 containerPort: {{ tuple "volume" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050097 readinessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000098 httpGet:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010099 scheme: {{ tuple "volume" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000100 path: /
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100101 port: {{ tuple "volume" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500102 livenessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000103 httpGet:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100104 scheme: {{ tuple "volume" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000105 path: /
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100106 port: {{ tuple "volume" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko7ac2d722023-10-03 15:19:33 +0200107 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500108 failureThreshold: 3
109 periodSeconds: 10
110 successThreshold: 1
111 timeoutSeconds: 1
112 volumeMounts:
113 - name: pod-tmp
114 mountPath: /tmp
115 - name: wsgi-cinder
116 mountPath: /var/www/cgi-bin/cinder
117 - name: cinder-bin
118 mountPath: /tmp/cinder-api.sh
119 subPath: cinder-api.sh
120 readOnly: true
121 - name: cinder-etc
Oleksandr Kozachenko7ac2d722023-10-03 15:19:33 +0200122 mountPath: /etc/cinder/cinder-api-uwsgi.ini
123 subPath: cinder-api-uwsgi.ini
124 readOnly: true
125 - name: cinder-etc
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500126 mountPath: /etc/cinder/cinder.conf
127 subPath: cinder.conf
128 readOnly: true
129 {{- if .Values.conf.cinder.DEFAULT.log_config_append }}
130 - name: cinder-etc
131 mountPath: {{ .Values.conf.cinder.DEFAULT.log_config_append }}
132 subPath: {{ base .Values.conf.cinder.DEFAULT.log_config_append }}
133 readOnly: true
134 {{- end }}
135 - name: cinder-etc
136 mountPath: /etc/cinder/api-paste.ini
137 subPath: api-paste.ini
138 readOnly: true
139 - name: cinder-etc
140 mountPath: /etc/cinder/policy.yaml
141 subPath: policy.yaml
142 readOnly: true
143 - name: cinder-etc
144 mountPath: /etc/cinder/api_audit_map.conf
145 subPath: api_audit_map.conf
146 readOnly: true
147 - name: cinder-etc
148 mountPath: {{ .Values.conf.cinder.DEFAULT.resource_query_filters_file }}
149 subPath: resource_filters.json
150 readOnly: true
151{{- if .Values.conf.security }}
152 - name: cinder-etc
153 mountPath: {{ .Values.conf.software.apache2.conf_dir }}/security.conf
154 subPath: security.conf
155 readOnly: true
156{{- end }}
157 {{- if eq ( split "://" .Values.conf.cinder.coordination.backend_url )._0 "file" }}
158 - name: cinder-coordination
159 mountPath: {{ ( split "://" .Values.conf.cinder.coordination.backend_url )._1 }}
160 {{- end }}
161 {{- if .Values.manifests.certificates }}
162 - name: cinder-etc
163 mountPath: {{ .Values.conf.software.apache2.site_dir }}/cinder-api.conf
164 subPath: wsgi-cinder.conf
165 readOnly: true
166 - name: cinder-etc
167 mountPath: {{ .Values.conf.software.apache2.mods_dir }}/mpm_event.conf
168 subPath: mpm_event.conf
169 readOnly: true
170 {{- end }}
171{{- 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 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100172{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.volume.api.internal "path" "/etc/cinder/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500173{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
174{{ if $mounts_cinder_api.volumeMounts }}{{ toYaml $mounts_cinder_api.volumeMounts | indent 12 }}{{ end }}
175 volumes:
176 - name: pod-tmp
177 emptyDir: {}
178 - name: wsgi-cinder
179 emptyDir: {}
180 - name: cinder-bin
181 configMap:
182 name: cinder-bin
183 defaultMode: 0555
184 - name: cinder-etc
185 secret:
186 secretName: cinder-etc
187 defaultMode: 0444
188 {{- if eq ( split "://" .Values.conf.cinder.coordination.backend_url )._0 "file" }}
189 # NOTE (portdirect): this will need to be set to a shared mount amongst all cinder
190 # pods for the coordination backend to be fully functional.
191 - name: cinder-coordination
192 emptyDir: {}
193 {{- end }}
194{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100195{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.volume.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500196{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
197{{ if $mounts_cinder_api.volumes }}{{ toYaml $mounts_cinder_api.volumes | indent 8 }}{{ end }}
198{{- end }}