blob: 2bcf64749d46bed9e2486b8808381cff63fff802 [file] [log] [blame]
vaibhavjayas5ca54652018-07-31 09:23:16 +00001# Copyright © 2018 Amdocs, Bell Canada
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030015apiVersion: batch/v1
16kind: Job
17metadata:
18 name: vid-config-galera
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: vid-config-galera
22 release: {{ .Release.Name }}
23spec:
24 template:
25 metadata:
Hector Anapan-Lavalle3d8a6a12018-08-07 21:31:05 -040026 labels:
27 release: {{ .Release.Name }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030028 name: vid-galera-init
29 spec:
30 initContainers:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000031#This container checks that all galera instances are up before initializing it.
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030032 - name: vid-init-galera-readiness
33 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
34 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030035 command:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000036 - /root/ready.py
37{{- $fullname := include "common.fullname" . -}}
38{{- range $i,$t := until (int .Values.vid_mariadb_galera.replicaCount)}}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030039 - --container-name
Mandeep Khinda561a91c2018-08-23 14:08:52 +000040 - {{ $fullname }}-mariadb-galera-{{$i}}
41{{- end }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030042 env:
43 - name: NAMESPACE
Mandeep Khinda561a91c2018-08-23 14:08:52 +000044 valueFrom:
45 fieldRef:
46 apiVersion: v1
47 fieldPath: metadata.namespace
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030048 containers:
49 - name: vid-config-galeradb
50 image: {{ .Values.mariadb_image }}
51 imagePullPolicy: "{{ .Values.pullPolicy }}"
52 volumeMounts:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000053 - mountPath: /dbcmd-config/db_cmd.sh
54 name: {{ include "common.fullname" . }}-config
55 subPath: db_cmd.sh
56 - mountPath: /db-config/vid-pre-init.sql
57 name: {{ include "common.fullname" . }}-config
58 subPath: vid-pre-init.sql
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030059 command:
60 - /bin/sh
61 args:
62 - -x
63 - /dbcmd-config/db_cmd.sh
64 env:
65 - name: MYSQL_PASSWORD
66 value: "{{ .Values.config.vidmysqlpassword }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030067 - name: MYSQL_HOST
68 value: "{{ .Values.config.vidmysqlhost }}"
Mandeep Khinda561a91c2018-08-23 14:08:52 +000069 - name: MYSQL_USER
70 value: "{{ .Values.config.vidmysqluser }}"
71 - name: MYSQL_PORT
72 value: "{{ .Values.config.vidmysqlport }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030073 restartPolicy: Never
Mandeep Khinda561a91c2018-08-23 14:08:52 +000074 volumes:
75 - name: {{ include "common.fullname" . }}-config
76 configMap:
77 name: {{ include "common.fullname" . }}
78 items:
79 - key: db_cmd.sh
80 path: db_cmd.sh
81 - key: vid-pre-init.sql
82 path: vid-pre-init.sql
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030083