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.job_ks_user_domain }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $serviceAccountName := "heat-ks-user-domain" }} |
| 19 | {{ tuple $envAll "ks_user" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 20 | --- |
| 21 | apiVersion: batch/v1 |
| 22 | kind: Job |
| 23 | metadata: |
| 24 | name: heat-domain-ks-user |
| 25 | labels: |
| 26 | {{ tuple $envAll "heat" "ks-user-domain" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 27 | annotations: |
| 28 | {{- if .Values.helm3_hook }} |
| 29 | "helm.sh/hook": post-install,post-upgrade |
| 30 | "helm.sh/hook-delete-policy": before-hook-creation |
| 31 | {{- end }} |
| 32 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 33 | spec: |
| 34 | template: |
| 35 | metadata: |
| 36 | labels: |
| 37 | {{ tuple $envAll "heat" "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 38 | annotations: |
| 39 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 40 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 41 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 42 | {{ dict "envAll" $envAll "podName" "heat-domain-ks-user" "containerNames" (list "heat-ks-domain-user" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 43 | spec: |
| 44 | serviceAccountName: {{ $serviceAccountName }} |
| 45 | {{ dict "envAll" $envAll "application" "ks_user" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 46 | restartPolicy: OnFailure |
| 47 | nodeSelector: |
| 48 | {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 49 | {{ if $envAll.Values.pod.tolerations.heat.enabled }} |
| 50 | {{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 51 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 52 | initContainers: |
| 53 | {{ tuple $envAll "ks_user" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 54 | containers: |
| 55 | - name: heat-ks-domain-user |
| 56 | {{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 57 | {{ dict "envAll" $envAll "application" "ks_user" "container" "heat_ks_domain_user" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 58 | command: |
| 59 | - /tmp/ks-domain-user.sh |
| 60 | volumeMounts: |
| 61 | - name: pod-tmp |
| 62 | mountPath: /tmp |
| 63 | - name: ks-user-sh |
| 64 | mountPath: /tmp/ks-domain-user.sh |
| 65 | subPath: ks-domain-user.sh |
| 66 | readOnly: true |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 67 | {{ dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 68 | env: |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 69 | {{- with $env := dict "ksUserSecret" $envAll.Values.secrets.identity.admin "useCA" (or .Values.manifests.certificates .Values.tls.identity) }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 70 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }} |
| 71 | {{- end }} |
| 72 | - name: SERVICE_OS_SERVICE_NAME |
| 73 | value: "heat" |
| 74 | - name: SERVICE_OS_REGION_NAME |
| 75 | valueFrom: |
| 76 | secretKeyRef: |
| 77 | name: {{ .Values.secrets.identity.heat_stack_user }} |
| 78 | key: OS_REGION_NAME |
| 79 | - name: SERVICE_OS_DOMAIN_NAME |
| 80 | valueFrom: |
| 81 | secretKeyRef: |
| 82 | name: {{ .Values.secrets.identity.heat_stack_user }} |
| 83 | key: OS_DOMAIN_NAME |
| 84 | - name: SERVICE_OS_USERNAME |
| 85 | valueFrom: |
| 86 | secretKeyRef: |
| 87 | name: {{ .Values.secrets.identity.heat_stack_user }} |
| 88 | key: OS_USERNAME |
| 89 | - name: SERVICE_OS_PASSWORD |
| 90 | valueFrom: |
| 91 | secretKeyRef: |
| 92 | name: {{ .Values.secrets.identity.heat_stack_user }} |
| 93 | key: OS_PASSWORD |
| 94 | - name: SERVICE_OS_ROLE |
| 95 | value: {{ .Values.endpoints.identity.auth.heat_stack_user.role | quote }} |
| 96 | volumes: |
| 97 | - name: pod-tmp |
| 98 | emptyDir: {} |
| 99 | - name: ks-user-sh |
| 100 | configMap: |
| 101 | name: heat-bin |
| 102 | defaultMode: 0555 |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 103 | {{- 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] | 104 | {{- end }} |