blob: 0037fef329b21c3f7f61a524511a71f0ef1a0923 [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 }}
16{{- $envAll := . }}
17
18{{- $mounts_horizon := .Values.pod.mounts.horizon.horizon }}
19{{- $mounts_horizon_init := .Values.pod.mounts.horizon.init_container }}
20
21{{- $serviceAccountName := "horizon" }}
22{{ tuple $envAll "dashboard" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: horizon
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.server }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "horizon" "server" | 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 "horizon" "server" | 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" }}
okozachenko1203187edfa2023-08-19 00:01:35 +100046{{- if .Values.manifests.configmap_logo }}
47 configmap-logo-hash: {{ tuple "configmap-logo.yaml" . | include "helm-toolkit.utils.hash" }}
48{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050049{{ dict "envAll" $envAll "podName" "horizon" "containerNames" (list "horizon" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
50 spec:
51 serviceAccountName: {{ $serviceAccountName }}
52{{ dict "envAll" $envAll "application" "horizon" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
53 affinity:
54{{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
55 nodeSelector:
56 {{ .Values.labels.dashboard.node_selector_key }}: {{ .Values.labels.dashboard.node_selector_value }}
57{{ if $envAll.Values.pod.tolerations.horizon.enabled }}
58{{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
59{{ end }}
60 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.horizon.timeout | default "30" }}
61 initContainers:
62{{ tuple $envAll "dashboard" $mounts_horizon_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
63 containers:
64 - name: horizon
65{{ tuple $envAll "horizon" | include "helm-toolkit.snippets.image" | indent 10 }}
66{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
67{{ dict "envAll" $envAll "application" "horizon" "container" "horizon" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
68 command:
69 - /tmp/horizon.sh
70 - start
71 env:
72 - name: MY_POD_IP
73 valueFrom:
74 fieldRef:
75 fieldPath: status.podIP
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000076{{- if or .Values.manifests.certificates .Values.tls.identity }}
77 - name: REQUESTS_CA_BUNDLE
78 value: "/etc/openstack-dashboard/certs/ca.crt"
79{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050080 lifecycle:
81 preStop:
82 exec:
83 command:
84 - /tmp/horizon.sh
85 - stop
86 ports:
87 - name: web
88 containerPort: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
89 readinessProbe:
90 httpGet:
91 scheme: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
92 path: /
93 port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
94 initialDelaySeconds: 15
95 periodSeconds: 10
okozachenko120377c6d672023-03-25 00:17:28 +110096 timeoutSeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050097 livenessProbe:
98 httpGet:
99 scheme: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
100 path: /
101 port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
102 initialDelaySeconds: 180
103 periodSeconds: 60
104 timeoutSeconds: 5
105 volumeMounts:
106 - name: pod-tmp
107 mountPath: /tmp
108 - name: static-horizon
109 mountPath: /var/www/html/
110 - name: horizon-bin
111 mountPath: /tmp/horizon.sh
112 subPath: horizon.sh
113 readOnly: true
114 - name: horizon-bin
115 mountPath: /tmp/manage.py
116 subPath: manage.py
117 readOnly: true
118 - name: horizon-etc
119 mountPath: {{ .Values.conf.software.apache2.site_dir }}/000-default.conf
120 subPath: horizon.conf
121 readOnly: true
122 {{- if .Values.conf.horizon.security }}
123 - name: horizon-etc
124 mountPath: {{ .Values.conf.software.apache2.conf_dir }}/security.conf
125 subPath: security.conf
126 readOnly: true
127 {{- end }}
128 - name: horizon-bin
129 mountPath: /var/www/cgi-bin/horizon/django.wsgi
130 subPath: django.wsgi
131 readOnly: true
132 - name: horizon-etc
133 mountPath: /etc/openstack-dashboard/local_settings
134 subPath: local_settings
135 readOnly: true
136 {{- range $key, $value := $envAll.Values.conf.horizon.policy }}
137 {{- $policyYamlFile := printf "/etc/openstack-dashboard/%s_policy.yaml" $key }}
138 - name: horizon-etc
139 mountPath: {{ $policyYamlFile }}
140 subPath: {{ base $policyYamlFile }}
141 readOnly: true
142 {{- end }}
143 {{- range $key, $value := $envAll.Values.conf.horizon.policy }}
144 {{- $policyJsonFile := printf "/etc/openstack-dashboard/%s_policy.json" $key }}
145 - name: horizon-etc
146 mountPath: {{ $policyJsonFile }}
147 subPath: {{ base $policyJsonFile }}
148 readOnly: true
149 {{- end }}
150 {{- range $key, $value := $envAll.Values.conf.horizon.local_settings_d }}
151 {{- $localSettingsFile := printf "/etc/openstack-dashboard/local_settings.d/%s.py" $key }}
152 - name: horizon-etc
153 mountPath: {{ $localSettingsFile }}
154 subPath: {{ base $localSettingsFile }}
155 readOnly: true
156 {{- end }}
157 {{- if .Values.manifests.configmap_logo }}
158 - name: horizon-logo
159 mountPath: /tmp/logo.svg
160 subPath: logo.svg
161 - name: horizon-logo
162 mountPath: /tmp/logo-splash.svg
163 subPath: logo-splash.svg
164 - name: horizon-logo
165 mountPath: /tmp/favicon.ico
166 subPath: favicon.ico
167 {{- end }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000168{{- dict "enabled" (or $envAll.Values.manifests.certificates $envAll.Values.tls.identity) "name" $envAll.Values.secrets.tls.dashboard.dashboard.internal "path" "/etc/openstack-dashboard/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500169{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
170{{ if $mounts_horizon.volumeMounts }}{{ toYaml $mounts_horizon.volumeMounts | indent 12 }}{{ end }}
171 volumes:
172 - name: pod-tmp
173 emptyDir: {}
174 - name: wsgi-horizon
175 emptyDir: {}
176 - name: static-horizon
177 emptyDir: {}
178 - name: horizon-bin
179 configMap:
180 name: horizon-bin
181 defaultMode: 0555
182 - name: horizon-etc
183 secret:
184 secretName: horizon-etc
185 defaultMode: 0444
186 {{- if .Values.manifests.configmap_logo }}
187 - name: horizon-logo
188 configMap:
189 name: horizon-logo
190 {{- end }}
191{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000192{{- dict "enabled" (or $envAll.Values.manifests.certificates $envAll.Values.tls.identity) "name" $envAll.Values.secrets.tls.dashboard.dashboard.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500193{{ if $mounts_horizon.volumes }}{{ toYaml $mounts_horizon.volumes | indent 8 }}{{ end }}
194{{- end }}