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 or ( .Values.manifests.deployment_engine ) ( .Values.manifests.statefulset_engine ) }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_heat_engine := .Values.pod.mounts.heat_engine.heat_engine }} |
| 19 | {{- $mounts_heat_engine_init := .Values.pod.mounts.heat_engine.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "heat-engine" }} |
| 22 | {{ tuple $envAll "engine" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | metadata: |
| 26 | name: heat-engine |
| 27 | annotations: |
| 28 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 29 | labels: |
| 30 | {{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 31 | {{- if .Values.manifests.deployment_engine }} |
| 32 | kind: Deployment |
| 33 | spec: |
| 34 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 35 | {{- else if .Values.manifests.statefulset_engine }} |
| 36 | kind: StatefulSet |
| 37 | spec: |
| 38 | serviceName: heat-engine |
| 39 | {{- end }} |
| 40 | replicas: {{ .Values.pod.replicas.engine }} |
| 41 | selector: |
| 42 | matchLabels: |
| 43 | {{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 44 | template: |
| 45 | metadata: |
| 46 | labels: |
| 47 | {{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 48 | {{- if .Values.manifests.deployment_engine }} |
| 49 | annotations: |
| 50 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 51 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 52 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 53 | {{ dict "envAll" $envAll "podName" "heat-engine" "containerNames" (list "heat-engine" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 54 | {{- end }} |
| 55 | spec: |
| 56 | serviceAccountName: {{ $serviceAccountName }} |
| 57 | {{ dict "envAll" $envAll "application" "heat" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 58 | affinity: |
| 59 | {{- tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 60 | nodeSelector: |
| 61 | {{ .Values.labels.engine.node_selector_key }}: {{ .Values.labels.engine.node_selector_value }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 62 | {{ if $envAll.Values.pod.tolerations.heat.enabled }} |
| 63 | {{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 64 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 65 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.engine.timeout | default "30" }} |
| 66 | initContainers: |
| 67 | {{ tuple $envAll "engine" $mounts_heat_engine_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 68 | containers: |
| 69 | - name: heat-engine |
| 70 | {{ tuple $envAll "heat_engine" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 71 | {{ tuple $envAll $envAll.Values.pod.resources.engine | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 72 | {{ dict "envAll" $envAll "application" "heat" "container" "heat_engine" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 73 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 74 | env: |
| 75 | - name: REQUESTS_CA_BUNDLE |
| 76 | value: "/etc/heat/certs/ca.crt" |
| 77 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 78 | command: |
| 79 | - /tmp/heat-engine.sh |
| 80 | - start |
| 81 | lifecycle: |
| 82 | preStop: |
| 83 | exec: |
| 84 | command: |
| 85 | - /tmp/heat-engine.sh |
| 86 | - stop |
| 87 | volumeMounts: |
| 88 | - name: pod-tmp |
| 89 | mountPath: /tmp |
| 90 | - name: pod-etc-heat |
| 91 | mountPath: /etc/heat |
| 92 | - name: heat-bin |
| 93 | mountPath: /tmp/heat-engine.sh |
| 94 | subPath: heat-engine.sh |
| 95 | readOnly: true |
| 96 | - name: heat-etc |
| 97 | mountPath: /etc/heat/heat.conf |
| 98 | subPath: heat.conf |
| 99 | readOnly: true |
| 100 | {{ if .Values.conf.heat.DEFAULT.log_config_append }} |
| 101 | - name: heat-etc |
| 102 | mountPath: {{ .Values.conf.heat.DEFAULT.log_config_append }} |
| 103 | subPath: {{ base .Values.conf.heat.DEFAULT.log_config_append }} |
| 104 | readOnly: true |
| 105 | {{ end }} |
| 106 | - name: heat-etc |
| 107 | mountPath: /etc/heat/policy.yaml |
| 108 | subPath: policy.yaml |
| 109 | readOnly: true |
| 110 | {{- 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 }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 111 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.orchestration.api.internal "path" "/etc/heat/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 112 | {{- 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 }} |
| 113 | {{ if $mounts_heat_engine.volumeMounts }}{{ toYaml $mounts_heat_engine.volumeMounts | indent 12 }}{{ end }} |
| 114 | volumes: |
| 115 | - name: pod-tmp |
| 116 | emptyDir: {} |
| 117 | - name: pod-etc-heat |
| 118 | emptyDir: {} |
| 119 | - name: heat-bin |
| 120 | configMap: |
| 121 | name: heat-bin |
| 122 | defaultMode: 0555 |
| 123 | - name: heat-etc |
| 124 | secret: |
| 125 | secretName: heat-etc |
| 126 | defaultMode: 0444 |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 127 | {{- 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 }} |
| 128 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 129 | {{- 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 }} |
| 130 | {{ if $mounts_heat_engine.volumes }}{{ toYaml $mounts_heat_engine.volumes | indent 8 }}{{ end }} |
| 131 | {{- end }} |