[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / common / music / charts / music-cassandra-job / templates / job.yaml
1 {{/*
2 # Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
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" . }}-config
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}-job
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}-job
32         release: {{ include "common.release" . }}
33     spec:
34       restartPolicy: Never
35       initContainers:
36       - name: {{ include "common.name" . }}-readiness
37         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
38         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
39         command:
40         - /app/ready.py
41         args:
42         - --timeout
43         - "{{ .Values.global.readinessTimeout }}"
44         - --container-name
45         - music-cassandra
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52       containers:
53       - name: {{ include "common.name" . }}-update-job
54         image: "{{ .Values.global.repository }}/{{ .Values.job.cassandra.image }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         env:
57         - name: CASS_HOSTNAME
58           value: "{{ .Values.job.host }}"
59         - name: USERNAME
60           value: "{{ .Values.cql.adminUser.username }}"
61         - name: PORT
62           value: "{{ .Values.job.port }}"
63         - name: PASSWORD
64           value: "{{ .Values.cql.adminUser.password }}"
65         - name: TIMEOUT
66           value: "{{ .Values.job.timeout }}"
67         - name: DELAY 
68           value: "{{ .Values.job.delay }}"
69         volumeMounts:
70         # Admin cql Files that setup Admin Keyspace and Change Admin user.
71         - name: {{ include "common.name" . }}-cql
72           mountPath: /cql/admin.cql
73           subPath: admin.cql
74         - name: {{ include "common.name" . }}-cql
75           mountPath: /cql/admin_pw.cql
76           subPath: admin_pw.cql
77         # This is where Apps or MISC will put any of their own startup cql scripts.
78         - name: {{ include "common.name" . }}-extra-cql
79           mountPath: /cql/extra
80       volumes:
81       - name: {{ include "common.name" . }}-cql
82         configMap:
83           name: {{ include "common.fullname" . }}-cql
84       - name: {{ include "common.name" . }}-extra-cql
85         configMap:
86           name: {{ include "common.fullname" . }}-extra-cql
87       restartPolicy: Never
88       imagePullSecrets:
89       - name: "{{ include "common.namespace" . }}-docker-registry-key"
90