Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / platform / components / keycloak-init / components / keycloak-config-cli / templates / job.yaml
1 {{/*
2   # Copyright © adorsys GmbH & Co. KG
3   # Modifications © 2022, Deutsche Telekom
4   #
5   # Licensed under the Apache License, Version 2.0 (the "License");
6   # you may not use this file except in compliance with the License.
7   # You may obtain a copy of the License at
8   #
9   #       http://www.apache.org/licenses/LICENSE-2.0
10   #
11   # Unless required by applicable law or agreed to in writing, software
12   # distributed under the License is distributed on an "AS IS" BASIS,
13   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   # See the License for the specific language governing permissions and
15   # limitations under the License.
16 */}}
17 ---
18 apiVersion: batch/v1
19 kind: Job
20 metadata:
21   {{- with .Values.annotations }}
22   annotations:
23   {{- toYaml . | nindent 4 }}
24   {{- end }}
25   name: {{ template "keycloak-config-cli.fullname" . }}
26   labels:
27   {{- include "keycloak-config-cli.labels" . | nindent 4 }}
28 spec:
29   backoffLimit: {{ .Values.backoffLimit }}
30   template:
31     metadata:
32       {{- with .Values.podAnnotations }}
33       annotations:
34       {{- . | nindent 8 }}
35       {{- end }}
36       labels:
37       {{- include "keycloak-config-cli.selectorLabels" . | nindent 8 }}
38       {{- with .Values.podLabels }}
39     {{- toYaml . | nindent 8 }}
40     {{- end }}
41     spec:
42       {{- with .Values.image.pullSecrets }}
43       imagePullSecrets:
44       {{- toYaml . | nindent 8 }}
45       {{- end }}
46       restartPolicy: Never
47       containers:
48         - name: keycloak-config-cli
49           image: "{{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image.repository }}:{{ tpl .Values.image.tag $ }}"
50           imagePullPolicy: {{ .Values.image.pullPolicy }}
51           {{- with .Values.resources }}
52           resources:
53           {{- toYaml . | nindent 10 }}
54           {{- end }}
55           env:
56             {{- range $name, $value := .Values.env }}
57             - name: {{ $name | quote }}
58               value: {{ tpl $value $ | quote }}
59             {{- end }}
60             {{- range $name, $value := .Values.secrets }}
61             - name: {{ $name | quote }}
62               valueFrom:
63                 secretKeyRef:
64                   name: "{{ template "keycloak-config-cli.fullname" $ }}"
65                   key: {{ $name | quote }}
66             {{- end }}
67             {{- if and .Values.existingSecret .Values.existingSecretKey }}
68             - name: "KEYCLOAK_PASSWORD"
69               valueFrom:
70                 secretKeyRef:
71                   name: "{{ tpl .Values.existingSecret . }}"
72                   key: "{{ .Values.existingSecretKey }}"
73           {{- end }}
74           {{- with .Values.securityContext }}
75           securityContext:
76           {{- toYaml . | nindent 10 }}
77           {{- end }}
78           volumeMounts:
79             - name: config
80               mountPath: /config
81             {{- with .Values.extraVolumeMounts }}
82             {{- tpl . $ | nindent 12 }}
83             {{- end }}
84         {{ include "common.waitForJobContainer" . | indent 8 | trim }}
85       volumes:
86         - name: config
87           secret:
88             {{- if .Values.existingConfigSecret }}
89             secretName: "{{ tpl .Values.existingConfigSecret $ }}"
90             {{- else }}
91             secretName: "{{ template "keycloak-config-cli.fullname" . }}-config-realms"
92             {{- end }}
93             defaultMode: 0555
94         {{- with .Values.extraVolumes }}
95         {{- tpl . $ | nindent 8 }}
96         {{- end }}
97       {{- with .Values.serviceAccount }}
98       serviceAccountName: "{{ tpl . $ }}"
99       {{- end }}
100       {{- with .Values.securityContext }}
101       securityContext:
102       {{- toYaml . | nindent 8 }}
103   {{- end }}