b893dbf617163f53bad118abe3d064e8d9be9458
[oom.git] / kubernetes / vid / templates / vid-galera-config-job.yaml
1 # 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
15 apiVersion: batch/v1
16 kind: Job
17 metadata:
18   name: vid-config-galera
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: vid-config-galera
22     release: {{ .Release.Name }}
23 spec:
24   template:
25     metadata:
26       labels:
27         release: {{ .Release.Name }}
28       name: vid-galera-init
29     spec:
30       initContainers:
31 #dd775k:  This container checks that all galera instances are up before initializing it.
32       - name: vid-init-galera-readiness
33         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
34         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35 #        - /bin/sh
36 #        args:
37 #        - "-c"
38 #        - "sleep 1000000000m"
39         command:
40         - python
41         args:
42         - /root/vid_ready.py
43         - --container-name
44         - {{ include "common.fullname" . }}-mariadb-galera-0
45         env:
46         - name: NAMESPACE
47           value: {{ include "common.namespace" . }}
48         volumeMounts:
49         - name: init-config
50           mountPath: /root/
51       containers:
52       - name: vid-config-galeradb
53         image: {{ .Values.mariadb_image }}
54         imagePullPolicy: "{{ .Values.pullPolicy }}"
55         volumeMounts:
56         - name: vid-db-config
57           mountPath: /db-config
58         - name: dbcmd-config
59           mountPath: /dbcmd-config
60         command:
61         - /bin/sh
62         args:
63         - -x
64         - /dbcmd-config/db_cmd.sh
65         env:
66         - name: MYSQL_PASSWORD
67           value: "{{ .Values.config.vidmysqlpassword }}"
68 #          valueFrom:
69 #            secretKeyRef:
70 #              name: {{ template "common.fullname" . }}
71 #              key: vid-password
72         - name: MYSQL_HOST
73           value: "{{ .Values.config.vidmysqlhost }}"
74       volumes:
75         - name: vid-db-config
76           configMap:
77             name: {{ include "common.fullname" . }}-galera-sql-configmap
78         - name: dbcmd-config
79           configMap:
80             name: {{ include "common.fullname" . }}-dbcmd-configmap
81         - name: init-config
82           configMap:
83             name: {{ include "common.fullname" . }}-cluster-ready-configmap
84       restartPolicy: Never
85
86