3738ff4a2222794a7137fe76f51b49ac4d381315
[oom.git] / kubernetes / sdc / components / sdc-cs / 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: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   backoffLimit: 20
23   template:
24     metadata:
25       labels:
26         app: {{ include "common.name" . }}-job
27         release: {{ include "common.release" . }}
28     spec:
29       restartPolicy: Never
30       initContainers:
31       - name: {{ include "common.name" . }}-init-readiness
32         image: {{ include "repositoryGenerator.image.readiness" . }}
33         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34         command:
35         - /app/ready.py
36         args:
37         - --app-name
38         {{- if .Values.global.sdc_cassandra.localCluster }}
39         - sdc-cs
40         {{- else }}
41         - cassandra
42         {{- end }}
43         - "-t"
44         - "15"
45         env:
46         - name: NAMESPACE
47           valueFrom:
48             fieldRef:
49               apiVersion: v1
50               fieldPath: metadata.namespace
51         resources:
52           limits:
53             cpu: 100m
54             memory: 100Mi
55           requests:
56             cpu: 3m
57             memory: 20Mi
58       containers:
59       - name: {{ include "common.name" . }}-job
60         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.cassandraInitImage }}
61         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62         volumeMounts:
63         - name: {{ include "common.fullname" . }}-environments
64           mountPath: /home/sdc/chef-solo/environments/
65         - name: {{ include "common.fullname" . }}-chef-cache
66           mountPath: /home/sdc/chef-solo/cache
67         - name: {{ include "common.fullname" . }}-cqlshrc
68           mountPath: /home/sdc/.cassandra
69         env:
70         - name: ENVNAME
71           value: {{ .Values.env.name }}
72         - name: RELEASE
73           value: {{ .Values.config.release }}
74         - name: SDC_USER
75           valueFrom:
76             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
77         - name: SDC_PASSWORD
78           valueFrom:
79             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
80         - name: CS_PASSWORD
81           valueFrom:
82             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_password}
83         - name: HOST_IP
84           valueFrom:
85             fieldRef:
86               fieldPath: status.podIP
87         resources:
88           limits:
89             cpu: 800m
90             memory: 1024Mi
91           requests:
92             cpu: 200m
93             memory: 300Mi
94       {{ include "common.waitForJobContainer" . | indent 6 | trim }}
95       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
96       volumes:
97       - name: {{ include "common.fullname" . }}-environments
98         configMap:
99           name: {{ include "common.release" . }}-sdc-environments-configmap
100           defaultMode: 0755
101       - name: {{ include "common.fullname" . }}-chef-cache
102         emptyDir: {}
103       - name: {{ include "common.fullname" . }}-cqlshrc
104         configMap:
105           name: {{ include "common.release" . }}-sdc-cqlshrc
106       imagePullSecrets:
107       - name: "{{ include "common.namespace" . }}-docker-registry-key"