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 | {{- define "novaNovncproxyLivenessProbeTemplate" }} |
| 16 | tcpSocket: |
| 17 | port: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 18 | {{- end }} |
| 19 | |
| 20 | {{- define "novaNovncproxyReadinessProbeTemplate" }} |
| 21 | tcpSocket: |
| 22 | port: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 23 | {{- end }} |
| 24 | |
| 25 | {{- if and .Values.manifests.deployment_novncproxy ( eq .Values.console.console_kind "novnc" )}} |
| 26 | {{- $envAll := . }} |
| 27 | |
| 28 | {{- $mounts_nova_novncproxy := .Values.pod.mounts.nova_novncproxy.nova_novncproxy }} |
| 29 | {{- $mounts_nova_novncproxy_init := .Values.pod.mounts.nova_novncproxy.init_novncproxy }} |
| 30 | |
okozachenko1203 | ea639e7 | 2023-08-30 23:25:38 +1000 | [diff] [blame] | 31 | {{- $vencrypt_enabled := (contains "vencrypt" .Values.conf.nova.vnc.auth_schemes) }} |
| 32 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 33 | {{- $serviceAccountName := "nova-novncproxy" }} |
| 34 | {{ tuple $envAll "novncproxy" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 35 | --- |
| 36 | apiVersion: apps/v1 |
| 37 | kind: Deployment |
| 38 | metadata: |
| 39 | name: nova-novncproxy |
| 40 | annotations: |
| 41 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 42 | labels: |
| 43 | {{ tuple $envAll "nova" "novnc-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 44 | spec: |
| 45 | replicas: {{ .Values.pod.replicas.novncproxy }} |
| 46 | selector: |
| 47 | matchLabels: |
| 48 | {{ tuple $envAll "nova" "novnc-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 49 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 50 | template: |
| 51 | metadata: |
| 52 | labels: |
| 53 | {{ tuple $envAll "nova" "novnc-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 54 | annotations: |
| 55 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 56 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 57 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
Oleksandr K. | 24c88fd | 2024-12-08 22:28:50 -0800 | [diff] [blame] | 58 | {{ tuple "nova_novncproxy" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 59 | {{ dict "envAll" $envAll "podName" "nova-novncproxy" "containerNames" (list "nova-novncproxy" "nova-novncproxy-init-assets" "nova-novncproxy-init" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 60 | spec: |
Dong Ma | bb1ef1f | 2025-02-11 16:47:00 +0000 | [diff] [blame] | 61 | {{ with .Values.pod.priorityClassName.nova_novncproxy }} |
| 62 | priorityClassName: {{ . }} |
| 63 | {{ end }} |
| 64 | {{ with .Values.pod.runtimeClassName.nova_novncproxy }} |
| 65 | runtimeClassName: {{ . }} |
| 66 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 67 | serviceAccountName: {{ $serviceAccountName }} |
| 68 | {{ dict "envAll" $envAll "application" "nova" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 69 | affinity: |
| 70 | {{ tuple $envAll "nova" "novnc-proxy" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 71 | nodeSelector: |
| 72 | {{ .Values.labels.novncproxy.node_selector_key }}: {{ .Values.labels.novncproxy.node_selector_value }} |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 73 | {{ if $envAll.Values.pod.tolerations.nova.enabled }} |
| 74 | {{ tuple $envAll "nova" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 75 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 76 | {{- if .Values.pod.useHostNetwork.novncproxy }} |
| 77 | hostNetwork: true |
| 78 | dnsPolicy: ClusterFirstWithHostNet |
| 79 | {{- end }} |
| 80 | initContainers: |
| 81 | {{ tuple $envAll "novncproxy" $mounts_nova_novncproxy_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 82 | - name: nova-novncproxy-init |
| 83 | {{ tuple $envAll "nova_novncproxy" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 84 | {{ tuple $envAll $envAll.Values.pod.resources.novncproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 85 | {{ dict "envAll" $envAll "application" "nova" "container" "nova_novncproxy_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 86 | command: |
| 87 | - /tmp/nova-console-proxy-init.sh |
| 88 | volumeMounts: |
| 89 | - name: pod-tmp |
| 90 | mountPath: /tmp |
| 91 | - name: nova-bin |
| 92 | mountPath: /tmp/nova-console-proxy-init.sh |
| 93 | subPath: nova-console-proxy-init.sh |
| 94 | readOnly: true |
| 95 | - name: nova-etc |
| 96 | mountPath: /etc/nova/nova.conf |
| 97 | subPath: nova.conf |
| 98 | readOnly: true |
| 99 | {{- if .Values.conf.nova.DEFAULT.log_config_append }} |
| 100 | - name: nova-etc |
| 101 | mountPath: {{ .Values.conf.nova.DEFAULT.log_config_append }} |
| 102 | subPath: {{ base .Values.conf.nova.DEFAULT.log_config_append }} |
| 103 | readOnly: true |
| 104 | {{- end }} |
| 105 | - name: pod-shared |
| 106 | mountPath: /tmp/pod-shared |
| 107 | - name: nova-novncproxy-init-assets |
| 108 | {{ tuple $envAll "nova_novncproxy_assets" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 109 | {{ tuple $envAll $envAll.Values.pod.resources.novncproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 110 | {{ dict "envAll" $envAll "application" "nova" "container" "nova_novncproxy_init_assests" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 111 | command: |
| 112 | - /tmp/nova-console-proxy-init-assets.sh |
| 113 | volumeMounts: |
| 114 | - name: pod-tmp |
| 115 | mountPath: /tmp |
| 116 | - name: nova-bin |
| 117 | mountPath: /tmp/nova-console-proxy-init-assets.sh |
| 118 | subPath: nova-console-proxy-init-assets.sh |
| 119 | readOnly: true |
| 120 | - name: pod-usr-share-novnc |
| 121 | mountPath: /tmp/usr/share/novnc |
| 122 | containers: |
| 123 | - name: nova-novncproxy |
| 124 | {{ tuple $envAll "nova_novncproxy" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 125 | {{ tuple $envAll $envAll.Values.pod.resources.novncproxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 126 | {{ dict "envAll" $envAll "application" "nova" "container" "nova_novncproxy" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 127 | {{ dict "envAll" $envAll "component" "novncproxy" "container" "default" "type" "liveness" "probeTemplate" (include "novaNovncproxyLivenessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} |
| 128 | {{ dict "envAll" $envAll "component" "novncproxy" "container" "default" "type" "readiness" "probeTemplate" (include "novaNovncproxyReadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} |
| 129 | command: |
| 130 | - /tmp/nova-console-proxy.sh |
| 131 | ports: |
| 132 | - name: n-novnc |
| 133 | containerPort: {{ tuple "compute_novnc_proxy" "internal" "novnc_proxy" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 134 | volumeMounts: |
| 135 | - name: pod-tmp |
| 136 | mountPath: /tmp |
| 137 | - name: nova-bin |
| 138 | mountPath: /tmp/nova-console-proxy.sh |
| 139 | subPath: nova-console-proxy.sh |
| 140 | readOnly: true |
| 141 | - name: nova-etc |
| 142 | mountPath: /etc/nova/nova.conf |
| 143 | subPath: nova.conf |
| 144 | readOnly: true |
| 145 | - name: nova-etc |
| 146 | mountPath: /etc/nova/logging.conf |
| 147 | subPath: logging.conf |
| 148 | readOnly: true |
| 149 | - name: pod-usr-share-novnc |
| 150 | mountPath: /usr/share/novnc |
| 151 | readOnly: true |
| 152 | - name: pod-shared |
| 153 | mountPath: /tmp/pod-shared |
Oleksandr K. | 24c88fd | 2024-12-08 22:28:50 -0800 | [diff] [blame] | 154 | {{- if $vencrypt_enabled }} |
| 155 | - name: {{ .Values.secrets.tls.compute_novnc_proxy.vencrypt.internal }} |
| 156 | mountPath: /etc/pki/nova-novncproxy |
| 157 | readOnly: true |
| 158 | {{- end }} |
| 159 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 160 | {{- 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 }} |
| 161 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.compute_novnc_proxy.novncproxy.internal "path" "/etc/nova/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 162 | {{- 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 }} |
| 163 | {{ if $mounts_nova_novncproxy.volumeMounts }}{{ toYaml $mounts_nova_novncproxy.volumeMounts | indent 12 }}{{ end }} |
| 164 | volumes: |
| 165 | - name: pod-tmp |
| 166 | emptyDir: {} |
| 167 | - name: nova-bin |
| 168 | configMap: |
| 169 | name: nova-bin |
| 170 | defaultMode: 0555 |
| 171 | - name: nova-etc |
| 172 | secret: |
| 173 | secretName: nova-etc |
| 174 | defaultMode: 0444 |
| 175 | - name: pod-usr-share-novnc |
| 176 | emptyDir: {} |
| 177 | - name: pod-shared |
| 178 | emptyDir: {} |
Oleksandr K. | 24c88fd | 2024-12-08 22:28:50 -0800 | [diff] [blame] | 179 | {{- if $vencrypt_enabled }} |
| 180 | - name: {{ .Values.secrets.tls.compute_novnc_proxy.vencrypt.internal }} |
| 181 | secret: |
| 182 | secretName: {{ .Values.secrets.tls.compute_novnc_proxy.vencrypt.internal }} |
| 183 | defaultMode: 0444 |
| 184 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 185 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 186 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.compute_novnc_proxy.novncproxy.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 187 | {{- 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 }} |
| 188 | {{ if $mounts_nova_novncproxy.volumes }}{{ toYaml $mounts_nova_novncproxy.volumes | indent 8 }}{{ end }} |
| 189 | {{- end }} |