[DCAEMOD] Uses new tpls for repos / images
[oom.git] / kubernetes / oof / components / oof-has / templates / job-onboard.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" . }}-onboard
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       - image:  "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
37         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38         name: {{ include "common.name" . }}-readiness
39         command:
40         - /app/ready.py
41         args:
42         - --container-name
43         - "music-springboot"
44         - --container-name
45         - "music-cassandra"
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52       - command:
53         - /app/ready.py
54         args:
55         - -j
56         - "{{ include "common.release" . }}-music-cassandra-job-config"
57         env:
58         - name: NAMESPACE
59           valueFrom:
60             fieldRef:
61               apiVersion: v1
62               fieldPath: metadata.namespace
63         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
64         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65         name: {{ include "common.name" . }}-music-db-readiness
66       containers:
67       - image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69         name: {{ include "common.name" . }}-onboard
70         command:
71           - "/bin/sh"
72           - "-c"
73           - |
74              echo "job-onboard"
75         workingDir: /has
76         volumeMounts:
77           - mountPath: /etc/localtime
78             name: localtime
79             readOnly: true
80           - mountPath: /has/onboard.json
81             name: {{ .Values.global.commonConfigPrefix }}-config
82             subPath: onboard.json
83         resources:
84 {{ include "common.resources" . | indent 10 }}
85       nodeSelector:
86         {{- if .Values.nodeSelector }}
87 {{ toYaml .Values.nodeSelector | indent 8 }}
88         {{- end -}}
89         {{- if .Values.affinity }}
90       affinity:
91 {{ toYaml .Values.affinity | indent 8 }}
92         {{- end }}
93       volumes:
94       - name: localtime
95         hostPath:
96           path: /etc/localtime
97       - name: {{ .Values.global.commonConfigPrefix }}-config
98         configMap:
99           name: {{ .Values.global.commonConfigPrefix }}-configmap
100           items:
101           - key: onboard.json
102             path: onboard.json
103       restartPolicy: OnFailure
104       imagePullSecrets:
105       - name: "{{ include "common.namespace" . }}-docker-registry-key"