blob: 463877b96aa93b16a0035691a3cd8e15cbe40cbd [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
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020034 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010035 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020037 - /app/ready.py
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010038 - --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" }}"
jhhbf8d8a92020-09-10 14:01:49 -050068 resources:
69{{ include "common.resources" . }}
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010070 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