Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / sdc / components / sdc-onboarding-be / templates / job.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, AT&T, Bell Canada
3 # Modifications Copyright © 2018  ZTE
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   name: {{ include "common.fullname" . }}-cassandra-init
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}-job
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   backoffLimit: 20
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}-job
34         release: {{ include "common.release" . }}
35     spec:
36       restartPolicy: Never
37       initContainers:
38       - name: {{ include "common.name" . }}-job-completion
39         image: {{ include "repositoryGenerator.image.readiness" . }}
40         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
41         command:
42         - /app/ready.py
43         args:
44         - --job-name
45         - {{ include "common.release" . }}-sdc-cs-config-cassandra
46         - "-t"
47         - "20"
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         resources:
55           limits:
56             cpu: 100m
57             memory: 100Mi
58           requests:
59             cpu: 3m
60             memory: 20Mi
61       containers:
62       - name: {{ include "common.name" . }}-job
63         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.onboardingInitImage }}
64         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65         {{- if include "common.onServiceMesh" . }}
66         args:
67         - echo "waiting 10s for istio side cars to be up"; sleep 10s; /home/sdc/startup.sh
68         command:
69         - /bin/sh
70         - -c
71         {{- end }}
72         volumeMounts:
73         - name: {{ include "common.fullname" . }}-environments
74           mountPath: /home/sdc/chef-solo/environments/
75         env:
76         - name: ENVNAME
77           value: {{ .Values.env.name }}
78         - name: HOST_IP
79           valueFrom:
80             fieldRef:
81               fieldPath: status.podIP
82         - name: SDC_USER
83           valueFrom:
84             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
85         - name: SDC_PASSWORD
86           valueFrom:
87             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
88         - name: CS_PASSWORD
89           valueFrom:
90             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_password}
91         - name: CS_HOST_IP
92           value: "{{ .Values.global.sdc_cassandra.serviceName }}"
93         resources:
94           limits:
95             cpu: 800m
96             memory: 1024Mi
97           requests:
98             cpu: 200m
99             memory: 200Mi
100       {{ include "common.waitForJobContainer" . | indent 6 | trim }}
101       volumes:
102       - name: {{ include "common.fullname" . }}-environments
103         configMap:
104           name: {{ include "common.release" . }}-sdc-environments-configmap
105           defaultMode: 0755
106       imagePullSecrets:
107       - name: "{{ include "common.namespace" . }}-docker-registry-key"
108       restartPolicy: Never