blob: 6e76df8fe4b7adbaa104ad6d5f24b5a4f680d60a [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations 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---
21apiVersion: batch/v1
22kind: Job
23metadata:
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" }}
33spec:
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 Naserbcdd25c2023-01-18 03:38:47 +000049{{ if $envAll.Values.pod.tolerations.heat.enabled }}
50{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
51{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050052 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 Naserbcdd25c2023-01-18 03:38:47 +000067{{ 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 Naserf3f59a72023-01-15 21:02:04 -050068 env:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000069{{- with $env := dict "ksUserSecret" $envAll.Values.secrets.identity.admin "useCA" (or .Values.manifests.certificates .Values.tls.identity) }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050070{{- 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 Naserbcdd25c2023-01-18 03:38:47 +0000103{{- 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 Naserf3f59a72023-01-15 21:02:04 -0500104{{- end }}