Merge R3 into master
[it/dep.git] / ric-aux / helm / 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: {{ .Release.Name }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ .Release.Name }}
34     spec:
35       initContainers:
36       - image:  "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
37         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38         name: {{ include "common.name" . }}-readiness
39         command: ["/bin/sh", "-c"]
40         args: ["sed -i s/client.AppsV1beta1Api/client.AppsV1Api/g /root/ready.py && sed -i s/client.ExtensionsV1beta1Api/client.AppsV1Api/g /root/ready.py && /root/ready.py --container-name aaf-sms --container-name aaf-sms-quorumclient"]        
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47       containers:
48       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         name: {{ include "common.name" . }}-preload
51         command:
52           - "/sms/bin/preload"
53           - "-cacert"
54           - "/sms/certs/aaf_root_ca.cer"
55           - "-jsondir"
56           - "/preload/config"
57           - "-serviceport"
58           - "{{ .Values.service.internalPort }}"
59           - "-serviceurl"
60           - "https://aaf-sms.{{ include "common.namespace" . }}"
61         workingDir: /sms
62         volumeMounts:
63           - mountPath: /etc/localtime
64             name: localtime
65             readOnly: true
66           - mountPath: /preload/config
67             name: {{ include "common.name" . }}-preload
68         resources:
69 {{ include "common.resources" . | indent 10 }}
70         {{- if .Values.nodeSelector }}
71         nodeSelector:
72 {{ toYaml .Values.nodeSelector | indent 10 }}
73         {{- end -}}
74         {{- if .Values.affinity }}
75         affinity:
76 {{ toYaml .Values.affinity | indent 10 }}
77         {{- end }}
78       volumes:
79       - name: localtime
80         hostPath:
81           path: /etc/localtime
82       - name : {{ include "common.name" . }}-preload
83         configMap:
84           name: {{ include "common.fullname" . }}-preload
85       restartPolicy: OnFailure
86       imagePullSecrets:
87       - name: "{{ include "common.namespace" . }}-docker-registry-key"