[AAF] Use common secret in sms preload
[oom.git] / kubernetes / aaf / charts / 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:
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            cd /config-input;
55            for PFILE in `find . -not -type d | grep -v -F ..`; do
56              envsubst <${PFILE} >/config/${PFILE};
57            done"
58         env:
59         - name: AAI_USER
60           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "login") | indent 10 }}
61         - name: AAI_PASS_PLAIN
62           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-creds" "key" "password") | indent 10 }}
63
64         - name: CONDUCTOR_USER
65           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "login") | indent 10 }}
66         - name: CONDUCTOR_PASS_PLAIN
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "conductor-creds" "key" "password") | indent 10 }}
68
69         - name: SDNC_USER
70           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 10 }}
71         - name: SDNC_PASS_PLAIN
72           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 10 }}
73
74         - name: MUSIC_USER
75           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "login") | indent 10 }}
76         - name: MUSIC_PASS_PLAIN
77           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-creds" "key" "password") | indent 10 }}
78
79         - name: AAF_USER
80           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "login") | indent 10 }}
81         - name: AAF_PASS_PLAIN
82           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-creds" "key" "password") | indent 10 }}
83
84         - name: POLICY_PLAT_USER
85           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "login") | indent 10 }}
86         - name: POLICY_PLAT_PASS_PLAIN
87           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-plat-creds" "key" "password") | indent 10 }}
88
89         - name: POLICY_CLI_USER
90           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "login") | indent 10 }}
91         - name: POLICY_CLI_PASS_PLAIN
92           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-cli-creds" "key" "password") | indent 10 }}
93
94         - name: OSDF_PLACEMENT_USER
95           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "login") | indent 10 }}
96         - name: OSDF_PLACEMENT_PASS_PLAIN
97           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-creds" "key" "password") | indent 10 }}
98
99         - name: OSDF_PLACEMENT_SO_USER
100           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "login") | indent 10 }}
101         - name: OSDF_PLACEMENT_SO_PASS_PLAIN
102           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-so-creds" "key" "password") | indent 10 }}
103
104         - name: OSDF_PLACEMENT_VFC_USER
105           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "login") | indent 10 }}
106         - name: OSDF_PLACEMENT_VFC_PASS_PLAIN
107           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-placement-vfc-creds" "key" "password") | indent 10 }}
108
109         - name: OSDF_CM_SCHEDULER_USER
110           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "login") | indent 10 }}
111         - name: OSDF_CM_SCHEDULER_PASS_PLAIN
112           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-cm-scheduler-creds" "key" "password") | indent 10 }}
113
114         - name: CONFIG_DB_USER
115           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "login") | indent 10 }}
116         - name: CONFIG_DB_PASS_PLAIN
117           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "config-db-creds" "key" "password") | indent 10 }}
118
119         - name: OSDF_PCI_OPT_USER
120           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "login") | indent 10 }}
121         - name: OSDF_PCI_OPT_PASS_PLAIN
122           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-pci-opt-creds" "key" "password") | indent 10 }}
123
124         - name: OSDF_OPT_ENGINE_USER
125           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "login") | indent 10 }}
126         - name: OSDF_OPT_ENGINE_PASS_PLAIN
127           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "osdf-opt-engine-creds" "key" "password") | indent 10 }}
128         volumeMounts:
129         - mountPath: /config-input
130           name: {{ include "common.name" . }}-preload-input
131         - mountPath: /config/
132           name: {{ include "common.name" . }}-preload
133         image: "{{ .Values.global.envsubstImage }}"
134         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
135         name: {{ include "common.name" . }}-update-config
136       - image:  "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
137         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
138         name: {{ include "common.name" . }}-readiness
139         command:
140         - /root/ready.py
141         args:
142         - --container-name
143         - "aaf-sms"
144         - --container-name
145         - "aaf-sms-quorumclient"
146         env:
147         - name: NAMESPACE
148           valueFrom:
149             fieldRef:
150               apiVersion: v1
151               fieldPath: metadata.namespace
152       containers:
153       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
154         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
155         name: {{ include "common.name" . }}-preload
156         command:
157           - "/sms/bin/preload"
158           - "-cacert"
159           - "/sms/certs/aaf_root_ca.cer"
160           - "-jsondir"
161           - "/preload/config"
162           - "-serviceport"
163           - "{{ .Values.service.internalPort }}"
164           - "-serviceurl"
165           - "https://aaf-sms.{{ include "common.namespace" . }}"
166         workingDir: /sms
167         volumeMounts:
168           - mountPath: /etc/localtime
169             name: localtime
170             readOnly: true
171           - mountPath: /preload/config
172             name: {{ include "common.name" . }}-preload
173         resources:
174 {{ include "common.resources" . | indent 10 }}
175         {{- if .Values.nodeSelector }}
176         nodeSelector:
177 {{ toYaml .Values.nodeSelector | indent 10 }}
178         {{- end -}}
179         {{- if .Values.affinity }}
180         affinity:
181 {{ toYaml .Values.affinity | indent 10 }}
182         {{- end }}
183       volumes:
184       - name: localtime
185         hostPath:
186           path: /etc/localtime
187       - name: {{ include "common.name" . }}-preload-input
188         configMap:
189           name: {{ include "common.fullname" . }}-preload
190       - name: {{ include "common.name" . }}-preload
191         emptyDir:
192           medium: Memory
193       restartPolicy: OnFailure
194       imagePullSecrets:
195       - name: "{{ include "common.namespace" . }}-docker-registry-key"