blob: 57e363bf8d90d6b3c1d5cd12f384156427d9ae75 [file] [log] [blame]
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +01001# Copyright © 2018 Amdocs, Bell Canada
jhhd4258672020-08-09 12:08:08 -05002# Modifications Copyright © 2020 AT&T Intellectual Property
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +01003#
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
16apiVersion: batch/v1
17kind: Job
18metadata:
jhhd4258672020-08-09 12:08:08 -050019 name: {{ include "common.release" . }}-policy-galera-config
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010020 namespace: {{ include "common.namespace" . }}
21 labels:
22 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010023 release: {{ include "common.release" . }}
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010024spec:
25 template:
26 metadata:
27 labels:
28 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010029 release: {{ include "common.release" . }}
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010030 spec:
31 initContainers:
32#This container checks that all galera instances are up before initializing it.
33 - name: {{ include "common.name" . }}-readiness
34 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
35 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36 command:
37 - /root/ready.py
38 - --container-name
39 - {{ index .Values "mariadb-galera" "service" "name" }}
40 env:
41 - name: NAMESPACE
42 valueFrom:
43 fieldRef:
44 apiVersion: v1
45 fieldPath: metadata.namespace
46 containers:
jhhd4258672020-08-09 12:08:08 -050047 - name: {{ include "common.release" . }}-policy-galera-config
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010048 image: {{ .Values.mariadb_image }}
49 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50 volumeMounts:
51 - mountPath: /dbcmd-config/db.sh
52 name: {{ include "common.fullname" . }}-config
53 subPath: db.sh
54 command:
55 - /bin/sh
56 args:
57 - -x
58 - /dbcmd-config/db.sh
59 env:
60 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiak98a79cc2020-04-01 22:33:58 +020061 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 10 }}
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010062 - name: MYSQL_HOST
63 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
64 - name: MYSQL_USER
Krzysztof Opasiak98a79cc2020-04-01 22:33:58 +020065 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010066 - name: MYSQL_PORT
67 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
68 restartPolicy: Never
69 volumes:
70 - name: {{ include "common.fullname" . }}-config
71 configMap:
72 name: {{ include "common.fullname" . }}-db-configmap
73 items:
74 - key: db.sh
75 path: db.sh