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: |
| 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 Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 76 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 77 | - name: REQUESTS_CA_BUNDLE |
| 78 | value: "/etc/openstack-dashboard/certs/ca.crt" |
| 79 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 80 | 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 |
okozachenko1203 | 77c6d67 | 2023-03-25 00:17:28 +1100 | [diff] [blame] | 96 | timeoutSeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 97 | 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 Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 168 | {{- 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] | 169 | {{- 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 Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 192 | {{- 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] | 193 | {{ if $mounts_horizon.volumes }}{{ toYaml $mounts_horizon.volumes | indent 8 }}{{ end }} |
| 194 | {{- end }} |