6d9ecaa7cbb0376aad87a9642888eca2b0b66b32
[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   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ include "common.release" . }}
33     spec:
34       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
35       - command:
36         - sh
37         args:
38         - -c
39         - "export AAI_PASS=${AAI_PASS_PLAIN};
40            export CONDUCTOR_PASS=${CONDUCTOR_PASS_PLAIN};
41            export SDNC_PASS=${SDNC_PASS_PLAIN};
42            export MUSIC_PASS=${MUSIC_PASS_PLAIN};
43            export AAF_PASS=${AAF_PASS_PLAIN};
44            export POLICY_PLAT_PASS=${POLICY_PLAT_PASS_PLAIN};
45            export POLICY_CLI_PASS=${POLICY_CLI_PASS_PLAIN};
46            export OSDF_PLACEMENT_PASS=${OSDF_PLACEMENT_PASS_PLAIN};
47            export OSDF_PLACEMENT_SO_PASS=${OSDF_PLACEMENT_SO_PASS_PLAIN};
48            export OSDF_PLACMENET_VFC_PASS=${OSDF_PLACEMENT_VFC_PASS_PLAIN};
49            export OSDF_CM_SCHEDULER_PASS=${OSDF_CM_SCHEDULER_PASS_PLAIN};
50            export CONFIG_DB_PASS=${CONFIG_DB_PASS_PLAIN};
51            export OSDF_PCI_OPT_PASS=${OSDF_PCI_OPT_PASS_PLAIN};
52            export OSDF_OPT_ENGINE_PASS=${OSDF_OPT_ENGINE_PASS_PLAIN};
53            export SO_PASS=${SO_PASS_PLAIN};
54            export SDC_PASS=${SDC_PASS_PLAIN};
55            export CPS_PASS=${CPS_PASS_PLAIN};
56            cd /config-input;
57            for PFILE in `find . -not -type d | grep -v -F ..`; do
58              envsubst <${PFILE} >/config/${PFILE};
59            done"
60         env:
61         - name: AAI_USER
62           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "login") | indent 10 }}
63         - name: AAI_PASS_PLAIN
64           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "password") | indent 10 }}
65
66         - name: CONDUCTOR_USER
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "login") | indent 10 }}
68         - name: CONDUCTOR_PASS_PLAIN
69           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "password") | indent 10 }}
70
71         - name: SDNC_USER
72           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 10 }}
73         - name: SDNC_PASS_PLAIN
74           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 10 }}
75
76         - name: MUSIC_USER
77           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "login") | indent 10 }}
78         - name: MUSIC_PASS_PLAIN
79           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "password") | indent 10 }}
80
81         - name: AAF_USER
82           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "login") | indent 10 }}
83         - name: AAF_PASS_PLAIN
84           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "password") | indent 10 }}
85
86         - name: POLICY_PLAT_USER
87           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "login") | indent 10 }}
88         - name: POLICY_PLAT_PASS_PLAIN
89           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "password") | indent 10 }}
90
91         - name: POLICY_CLI_USER
92           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "login") | indent 10 }}
93         - name: POLICY_CLI_PASS_PLAIN
94           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "password") | indent 10 }}
95
96         - name: OSDF_PLACEMENT_USER
97           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "login") | indent 10 }}
98         - name: OSDF_PLACEMENT_PASS_PLAIN
99           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "password") | indent 10 }}
100
101         - name: OSDF_PLACEMENT_SO_USER
102           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "login") | indent 10 }}
103         - name: OSDF_PLACEMENT_SO_PASS_PLAIN
104           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "password") | indent 10 }}
105
106         - name: OSDF_PLACEMENT_VFC_USER
107           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "login") | indent 10 }}
108         - name: OSDF_PLACEMENT_VFC_PASS_PLAIN
109           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "password") | indent 10 }}
110
111         - name: OSDF_CM_SCHEDULER_USER
112           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "login") | indent 10 }}
113         - name: OSDF_CM_SCHEDULER_PASS_PLAIN
114           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "password") | indent 10 }}
115
116         - name: CONFIG_DB_USER
117           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "login") | indent 10 }}
118         - name: CONFIG_DB_PASS_PLAIN
119           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "password") | indent 10 }}
120
121         - name: OSDF_PCI_OPT_USER
122           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "login") | indent 10 }}
123         - name: OSDF_PCI_OPT_PASS_PLAIN
124           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "password") | indent 10 }}
125
126         - name: OSDF_OPT_ENGINE_USER
127           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "login") | indent 10 }}
128         - name: OSDF_OPT_ENGINE_PASS_PLAIN
129           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "password") | indent 10 }}
130
131         - name: SO_USER
132           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-creds" "key" "login") | indent 10 }}
133         - name: SO_PASS_PLAIN
134           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-creds" "key" "password") | indent 10 }}
135
136         - name: SDC_USER
137           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdc-creds" "key" "login") | indent 10 }}
138         - name: SDC_PASS_PLAIN
139           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdc-creds" "key" "password") | indent 10 }}
140
141         - name: CPS_USER
142           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-creds" "key" "login") | indent 10 }}
143         - name: CPS_PASS_PLAIN
144           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-creds" "key" "password") | indent 10 }}
145
146         volumeMounts:
147         - mountPath: /config-input
148           name: {{ include "common.name" . }}-preload-input
149         - mountPath: /config/
150           name: {{ include "common.name" . }}-preload
151         image: {{ include "repositoryGenerator.image.envsubst" . }}
152         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
153         name: {{ include "common.name" . }}-update-config
154       - image:  {{ include "repositoryGenerator.image.readiness" . }}
155         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
156         name: {{ include "common.name" . }}-readiness
157         command:
158         - /app/ready.py
159         args:
160         - --container-name
161         - "aaf-sms"
162         - --container-name
163         - "aaf-sms-quorumclient"
164         env:
165         - name: NAMESPACE
166           valueFrom:
167             fieldRef:
168               apiVersion: v1
169               fieldPath: metadata.namespace
170       containers:
171       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
172         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
173         name: {{ include "common.name" . }}-preload
174         command:
175           - "/sms/bin/preload"
176           - "-cacert"
177           - "{{ .Values.certInitializer.mountPath }}/local/{{ .Values.certInitializer.root_ca_name }}"
178           - "-jsondir"
179           - "/preload/config"
180           - "-serviceport"
181           - "{{ .Values.service.internalPort }}"
182           - "-serviceurl"
183           - "https://aaf-sms.{{ include "common.namespace" . }}"
184         workingDir: /sms
185         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
186           - mountPath: /etc/localtime
187             name: localtime
188             readOnly: true
189           - mountPath: /preload/config
190             name: {{ include "common.name" . }}-preload
191         resources:
192 {{ include "common.resources" . | indent 10 }}
193         {{- if .Values.nodeSelector }}
194         nodeSelector:
195 {{ toYaml .Values.nodeSelector | indent 10 }}
196         {{- end -}}
197         {{- if .Values.affinity }}
198         affinity:
199 {{ toYaml .Values.affinity | indent 10 }}
200         {{- end }}
201       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
202       - name: localtime
203         hostPath:
204           path: /etc/localtime
205       - name: {{ include "common.name" . }}-preload-input
206         configMap:
207           name: {{ include "common.fullname" . }}-preload
208       - name: {{ include "common.name" . }}-preload
209         emptyDir:
210           medium: Memory
211       restartPolicy: OnFailure
212       imagePullSecrets:
213       - name: "{{ include "common.namespace" . }}-docker-registry-key"