blob: 9ed09e82d7f6e38d1b050ba8e41bf41ba0d905ba [file] [log] [blame]
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +01001# 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
15apiVersion: batch/v1
16kind: Job
17metadata:
18 name: {{ .Release.Name }}-galera-config
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.name" . }}-job
22 release: {{ .Release.Name }}
23spec:
24 template:
25 metadata:
26 labels:
27 app: {{ include "common.name" . }}-job
28 release: {{ .Release.Name }}
29 spec:
30 initContainers:
31#This container checks that all galera instances are up before initializing it.
32 - name: {{ include "common.name" . }}-readiness
33 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
34 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35 command:
36 - /root/ready.py
37 - --container-name
38 - {{ index .Values "mariadb-galera" "service" "name" }}
39 env:
40 - name: NAMESPACE
41 valueFrom:
42 fieldRef:
43 apiVersion: v1
44 fieldPath: metadata.namespace
45 containers:
46 - name: {{ .Release.Name }}-galera-config
47 image: {{ .Values.mariadb_image }}
48 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49 volumeMounts:
50 - mountPath: /dbcmd-config/db.sh
51 name: {{ include "common.fullname" . }}-config
52 subPath: db.sh
53 command:
54 - /bin/sh
55 args:
56 - -x
57 - /dbcmd-config/db.sh
58 env:
59 - name: MYSQL_ROOT_PASSWORD
60 valueFrom:
61 secretKeyRef:
62 name: {{ template "common.fullname" . }}-secret
63 key: db-root-password
64 - name: MYSQL_HOST
65 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
66 - name: MYSQL_USER
67 value: "{{ index .Values "mariadb-galera" "config" "userName" }}"
68 - name: MYSQL_PORT
69 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
70 restartPolicy: Never
71 volumes:
72 - name: {{ include "common.fullname" . }}-config
73 configMap:
74 name: {{ include "common.fullname" . }}-db-configmap
75 items:
76 - key: db.sh
77 path: db.sh