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