blob: 4521148d3591461cc4f8345474abd0cfe3c3fbb2 [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 := "magnum-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: magnum-domain-ks-user
25 annotations:
26 "helm.sh/hook": post-install,post-upgrade
27 "helm.sh/hook-delete-policy": before-hook-creation
28 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
29spec:
30 template:
31 metadata:
32 labels:
33{{ tuple $envAll "magnum" "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
34 spec:
35 serviceAccountName: {{ $serviceAccountName }}
36 restartPolicy: OnFailure
37 nodeSelector:
38 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
39 initContainers:
40{{ tuple $envAll "ks_user" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
41 containers:
42 - name: magnum-ks-domain-user
43{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 10 }}
44 command:
45 - /tmp/ks-domain-user.sh
46 volumeMounts:
47 - name: pod-tmp
48 mountPath: /tmp
49 - name: ks-user-sh
50 mountPath: /tmp/ks-domain-user.sh
51 subPath: ks-domain-user.sh
52 readOnly: true
53 env:
54{{- with $env := dict "ksUserSecret" $envAll.Values.secrets.identity.admin }}
55{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
56{{- end }}
57 - name: SERVICE_OS_SERVICE_NAME
58 value: "magnum"
59 - name: SERVICE_OS_REGION_NAME
60 valueFrom:
61 secretKeyRef:
62 name: {{ .Values.secrets.identity.magnum_stack_user }}
63 key: OS_REGION_NAME
64 - name: SERVICE_OS_DOMAIN_NAME
65 valueFrom:
66 secretKeyRef:
67 name: {{ .Values.secrets.identity.magnum_stack_user }}
68 key: OS_DOMAIN_NAME
69 - name: SERVICE_OS_USERNAME
70 valueFrom:
71 secretKeyRef:
72 name: {{ .Values.secrets.identity.magnum_stack_user }}
73 key: OS_USERNAME
74 - name: SERVICE_OS_PASSWORD
75 valueFrom:
76 secretKeyRef:
77 name: {{ .Values.secrets.identity.magnum_stack_user }}
78 key: OS_PASSWORD
79 - name: SERVICE_OS_ROLE
80 value: {{ .Values.endpoints.identity.auth.magnum_stack_user.role | quote }}
81 volumes:
82 - name: pod-tmp
83 emptyDir: {}
84 - name: ks-user-sh
85 configMap:
86 name: magnum-bin
87 defaultMode: 0555
88{{- end }}