[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / aaf / components / aaf-sms / templates / job.yaml
1 {{/*
2 # Copyright 2018 Intel Corporation, Inc
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 apiVersion: batch/v1
18 kind: Job
19 metadata:
20   name: {{ include "common.fullname" . }}-preload
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
36       - command:
37         - sh
38         args:
39         - -c
40         - "export AAI_PASS=${AAI_PASS_PLAIN};
41            export CONDUCTOR_PASS=${CONDUCTOR_PASS_PLAIN};
42            export SDNC_PASS=${SDNC_PASS_PLAIN};
43            export MUSIC_PASS=${MUSIC_PASS_PLAIN};
44            export AAF_PASS=${AAF_PASS_PLAIN};
45            export POLICY_PLAT_PASS=${POLICY_PLAT_PASS_PLAIN};
46            export POLICY_CLI_PASS=${POLICY_CLI_PASS_PLAIN};
47            export OSDF_PLACEMENT_PASS=${OSDF_PLACEMENT_PASS_PLAIN};
48            export OSDF_PLACEMENT_SO_PASS=${OSDF_PLACEMENT_SO_PASS_PLAIN};
49            export OSDF_PLACMENET_VFC_PASS=${OSDF_PLACEMENT_VFC_PASS_PLAIN};
50            export OSDF_CM_SCHEDULER_PASS=${OSDF_CM_SCHEDULER_PASS_PLAIN};
51            export CONFIG_DB_PASS=${CONFIG_DB_PASS_PLAIN};
52            export OSDF_PCI_OPT_PASS=${OSDF_PCI_OPT_PASS_PLAIN};
53            export OSDF_OPT_ENGINE_PASS=${OSDF_OPT_ENGINE_PASS_PLAIN};
54            export SO_PASS=${SO_PASS_PLAIN};
55            cd /config-input;
56            for PFILE in `find . -not -type d | grep -v -F ..`; do
57              envsubst <${PFILE} >/config/${PFILE};
58            done"
59         env:
60         - name: AAI_USER
61           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "login") | indent 10 }}
62         - name: AAI_PASS_PLAIN
63           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "password") | indent 10 }}
64
65         - name: CONDUCTOR_USER
66           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "login") | indent 10 }}
67         - name: CONDUCTOR_PASS_PLAIN
68           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "password") | indent 10 }}
69
70         - name: SDNC_USER
71           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 10 }}
72         - name: SDNC_PASS_PLAIN
73           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 10 }}
74
75         - name: MUSIC_USER
76           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "login") | indent 10 }}
77         - name: MUSIC_PASS_PLAIN
78           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "password") | indent 10 }}
79
80         - name: AAF_USER
81           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "login") | indent 10 }}
82         - name: AAF_PASS_PLAIN
83           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "password") | indent 10 }}
84
85         - name: POLICY_PLAT_USER
86           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "login") | indent 10 }}
87         - name: POLICY_PLAT_PASS_PLAIN
88           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "password") | indent 10 }}
89
90         - name: POLICY_CLI_USER
91           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "login") | indent 10 }}
92         - name: POLICY_CLI_PASS_PLAIN
93           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "password") | indent 10 }}
94
95         - name: OSDF_PLACEMENT_USER
96           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "login") | indent 10 }}
97         - name: OSDF_PLACEMENT_PASS_PLAIN
98           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "password") | indent 10 }}
99
100         - name: OSDF_PLACEMENT_SO_USER
101           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "login") | indent 10 }}
102         - name: OSDF_PLACEMENT_SO_PASS_PLAIN
103           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "password") | indent 10 }}
104
105         - name: OSDF_PLACEMENT_VFC_USER
106           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "login") | indent 10 }}
107         - name: OSDF_PLACEMENT_VFC_PASS_PLAIN
108           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "password") | indent 10 }}
109
110         - name: OSDF_CM_SCHEDULER_USER
111           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "login") | indent 10 }}
112         - name: OSDF_CM_SCHEDULER_PASS_PLAIN
113           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "password") | indent 10 }}
114
115         - name: CONFIG_DB_USER
116           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "login") | indent 10 }}
117         - name: CONFIG_DB_PASS_PLAIN
118           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "password") | indent 10 }}
119
120         - name: OSDF_PCI_OPT_USER
121           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "login") | indent 10 }}
122         - name: OSDF_PCI_OPT_PASS_PLAIN
123           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "password") | indent 10 }}
124
125         - name: OSDF_OPT_ENGINE_USER
126           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "login") | indent 10 }}
127         - name: OSDF_OPT_ENGINE_PASS_PLAIN
128           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "password") | indent 10 }}
129
130         - name: SO_USER
131           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-creds" "key" "login") | indent 10 }}
132         - name: SO_PASS_PLAIN
133           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-creds" "key" "password") | indent 10 }}
134
135         volumeMounts:
136         - mountPath: /config-input
137           name: {{ include "common.name" . }}-preload-input
138         - mountPath: /config/
139           name: {{ include "common.name" . }}-preload
140         image: "{{ .Values.global.envsubstImage }}"
141         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
142         name: {{ include "common.name" . }}-update-config
143       - image:  "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
144         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
145         name: {{ include "common.name" . }}-readiness
146         command:
147         - /app/ready.py
148         args:
149         - --container-name
150         - "aaf-sms"
151         - --container-name
152         - "aaf-sms-quorumclient"
153         env:
154         - name: NAMESPACE
155           valueFrom:
156             fieldRef:
157               apiVersion: v1
158               fieldPath: metadata.namespace
159       containers:
160       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
161         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
162         name: {{ include "common.name" . }}-preload
163         command:
164           - "/sms/bin/preload"
165           - "-cacert"
166           - "{{ .Values.certInitializer.mountPath }}/local/{{ .Values.certInitializer.root_ca_name }}"
167           - "-jsondir"
168           - "/preload/config"
169           - "-serviceport"
170           - "{{ .Values.service.internalPort }}"
171           - "-serviceurl"
172           - "https://aaf-sms.{{ include "common.namespace" . }}"
173         workingDir: /sms
174         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
175           - mountPath: /etc/localtime
176             name: localtime
177             readOnly: true
178           - mountPath: /preload/config
179             name: {{ include "common.name" . }}-preload
180         resources:
181 {{ include "common.resources" . | indent 10 }}
182         {{- if .Values.nodeSelector }}
183         nodeSelector:
184 {{ toYaml .Values.nodeSelector | indent 10 }}
185         {{- end -}}
186         {{- if .Values.affinity }}
187         affinity:
188 {{ toYaml .Values.affinity | indent 10 }}
189         {{- end }}
190       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
191       - name: localtime
192         hostPath:
193           path: /etc/localtime
194       - name: {{ include "common.name" . }}-preload-input
195         configMap:
196           name: {{ include "common.fullname" . }}-preload
197       - name: {{ include "common.name" . }}-preload
198         emptyDir:
199           medium: Memory
200       restartPolicy: OnFailure
201       imagePullSecrets:
202       - name: "{{ include "common.namespace" . }}-docker-registry-key"