Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations 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 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 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 }} |
| 32 | spec: |
| 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" }} |
okozachenko1203 | 187edfa | 2023-08-19 00:01:35 +1000 | [diff] [blame] | 46 | {{- if .Values.manifests.configmap_logo }} |
| 47 | configmap-logo-hash: {{ tuple "configmap-logo.yaml" . | include "helm-toolkit.utils.hash" }} |
| 48 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 49 | {{ dict "envAll" $envAll "podName" "horizon" "containerNames" (list "horizon" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 50 | spec: |
Dong Ma | 6be0a48 | 2025-02-10 13:14:30 +0000 | [diff] [blame] | 51 | {{ with .Values.pod.priorityClassName.horizon }} |
| 52 | priorityClassName: {{ . }} |
| 53 | {{ end }} |
| 54 | {{ with .Values.pod.runtimeClassName.horizon }} |
| 55 | runtimeClassName: {{ . }} |
| 56 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 57 | serviceAccountName: {{ $serviceAccountName }} |
| 58 | {{ dict "envAll" $envAll "application" "horizon" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 59 | affinity: |
| 60 | {{ tuple $envAll "horizon" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 61 | nodeSelector: |
| 62 | {{ .Values.labels.dashboard.node_selector_key }}: {{ .Values.labels.dashboard.node_selector_value }} |
| 63 | {{ if $envAll.Values.pod.tolerations.horizon.enabled }} |
| 64 | {{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 65 | {{ end }} |
| 66 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.horizon.timeout | default "30" }} |
| 67 | initContainers: |
| 68 | {{ tuple $envAll "dashboard" $mounts_horizon_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 69 | containers: |
| 70 | - name: horizon |
| 71 | {{ tuple $envAll "horizon" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 72 | {{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 73 | {{ dict "envAll" $envAll "application" "horizon" "container" "horizon" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 74 | command: |
| 75 | - /tmp/horizon.sh |
| 76 | - start |
| 77 | env: |
| 78 | - name: MY_POD_IP |
| 79 | valueFrom: |
| 80 | fieldRef: |
| 81 | fieldPath: status.podIP |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 82 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 83 | - name: REQUESTS_CA_BUNDLE |
| 84 | value: "/etc/openstack-dashboard/certs/ca.crt" |
| 85 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 86 | lifecycle: |
| 87 | preStop: |
| 88 | exec: |
| 89 | command: |
| 90 | - /tmp/horizon.sh |
| 91 | - stop |
| 92 | ports: |
| 93 | - name: web |
| 94 | containerPort: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 95 | readinessProbe: |
| 96 | httpGet: |
| 97 | scheme: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} |
| 98 | path: / |
| 99 | port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 100 | initialDelaySeconds: 15 |
| 101 | periodSeconds: 10 |
okozachenko1203 | 77c6d67 | 2023-03-25 00:17:28 +1100 | [diff] [blame] | 102 | timeoutSeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 103 | livenessProbe: |
| 104 | httpGet: |
| 105 | scheme: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} |
| 106 | path: / |
| 107 | port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 108 | initialDelaySeconds: 180 |
| 109 | periodSeconds: 60 |
| 110 | timeoutSeconds: 5 |
| 111 | volumeMounts: |
| 112 | - name: pod-tmp |
| 113 | mountPath: /tmp |
| 114 | - name: static-horizon |
| 115 | mountPath: /var/www/html/ |
| 116 | - name: horizon-bin |
| 117 | mountPath: /tmp/horizon.sh |
| 118 | subPath: horizon.sh |
| 119 | readOnly: true |
| 120 | - name: horizon-bin |
| 121 | mountPath: /tmp/manage.py |
| 122 | subPath: manage.py |
| 123 | readOnly: true |
| 124 | - name: horizon-etc |
| 125 | mountPath: {{ .Values.conf.software.apache2.site_dir }}/000-default.conf |
| 126 | subPath: horizon.conf |
| 127 | readOnly: true |
| 128 | {{- if .Values.conf.horizon.security }} |
| 129 | - name: horizon-etc |
| 130 | mountPath: {{ .Values.conf.software.apache2.conf_dir }}/security.conf |
| 131 | subPath: security.conf |
| 132 | readOnly: true |
| 133 | {{- end }} |
| 134 | - name: horizon-bin |
| 135 | mountPath: /var/www/cgi-bin/horizon/django.wsgi |
| 136 | subPath: django.wsgi |
| 137 | readOnly: true |
| 138 | - name: horizon-etc |
| 139 | mountPath: /etc/openstack-dashboard/local_settings |
| 140 | subPath: local_settings |
| 141 | readOnly: true |
| 142 | {{- range $key, $value := $envAll.Values.conf.horizon.policy }} |
| 143 | {{- $policyYamlFile := printf "/etc/openstack-dashboard/%s_policy.yaml" $key }} |
| 144 | - name: horizon-etc |
| 145 | mountPath: {{ $policyYamlFile }} |
| 146 | subPath: {{ base $policyYamlFile }} |
| 147 | readOnly: true |
| 148 | {{- end }} |
| 149 | {{- range $key, $value := $envAll.Values.conf.horizon.policy }} |
| 150 | {{- $policyJsonFile := printf "/etc/openstack-dashboard/%s_policy.json" $key }} |
| 151 | - name: horizon-etc |
| 152 | mountPath: {{ $policyJsonFile }} |
| 153 | subPath: {{ base $policyJsonFile }} |
| 154 | readOnly: true |
| 155 | {{- end }} |
| 156 | {{- range $key, $value := $envAll.Values.conf.horizon.local_settings_d }} |
| 157 | {{- $localSettingsFile := printf "/etc/openstack-dashboard/local_settings.d/%s.py" $key }} |
| 158 | - name: horizon-etc |
| 159 | mountPath: {{ $localSettingsFile }} |
| 160 | subPath: {{ base $localSettingsFile }} |
| 161 | readOnly: true |
| 162 | {{- end }} |
| 163 | {{- if .Values.manifests.configmap_logo }} |
| 164 | - name: horizon-logo |
| 165 | mountPath: /tmp/logo.svg |
| 166 | subPath: logo.svg |
| 167 | - name: horizon-logo |
| 168 | mountPath: /tmp/logo-splash.svg |
| 169 | subPath: logo-splash.svg |
| 170 | - name: horizon-logo |
| 171 | mountPath: /tmp/favicon.ico |
| 172 | subPath: favicon.ico |
| 173 | {{- end }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 174 | {{- 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 Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 175 | {{- 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 }} |
| 176 | {{ if $mounts_horizon.volumeMounts }}{{ toYaml $mounts_horizon.volumeMounts | indent 12 }}{{ end }} |
| 177 | volumes: |
| 178 | - name: pod-tmp |
| 179 | emptyDir: {} |
| 180 | - name: wsgi-horizon |
| 181 | emptyDir: {} |
| 182 | - name: static-horizon |
| 183 | emptyDir: {} |
| 184 | - name: horizon-bin |
| 185 | configMap: |
| 186 | name: horizon-bin |
| 187 | defaultMode: 0555 |
| 188 | - name: horizon-etc |
| 189 | secret: |
| 190 | secretName: horizon-etc |
| 191 | defaultMode: 0444 |
| 192 | {{- if .Values.manifests.configmap_logo }} |
| 193 | - name: horizon-logo |
| 194 | configMap: |
| 195 | name: horizon-logo |
| 196 | {{- end }} |
| 197 | {{- 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 Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 198 | {{- 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 Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 199 | {{ if $mounts_horizon.volumes }}{{ toYaml $mounts_horizon.volumes | indent 8 }}{{ end }} |
| 200 | {{- end }} |