blob: e71813a653ab886da86e0d99ae3deaec6e51213f [file] [log] [blame]
vaibhavjayas5ca54652018-07-31 09:23:16 +00001# Copyright © 2018 Amdocs, Bell Canada
Krzysztof Opasiak4a4703b2020-02-08 01:04:48 +01002# Copyright © 2020 Samsung Electronics
vaibhavjayas5ca54652018-07-31 09:23:16 +00003#
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
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030016apiVersion: batch/v1
17kind: Job
18metadata:
Julien Barbot8cd94472018-10-23 12:15:31 +020019 name: {{ include "common.fullname" . }}-galera-config
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030020 namespace: {{ include "common.namespace" . }}
21 labels:
Julien Barbot8cd94472018-10-23 12:15:31 +020022 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010023 release: {{ include "common.release" . }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030024spec:
25 template:
26 metadata:
Hector Anapan-Lavalle3d8a6a12018-08-07 21:31:05 -040027 labels:
Julien Barbot8cd94472018-10-23 12:15:31 +020028 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010029 release: {{ include "common.release" . }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030030 spec:
31 initContainers:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000032#This container checks that all galera instances are up before initializing it.
Julien Barbot8cd94472018-10-23 12:15:31 +020033 - name: {{ include "common.name" . }}-readiness
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020034 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030035 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030036 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020037 - /app/ready.py
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030038 - --container-name
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010039 - {{ index .Values "mariadb-galera" "service" "name" }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030040 env:
41 - name: NAMESPACE
Mandeep Khinda561a91c2018-08-23 14:08:52 +000042 valueFrom:
43 fieldRef:
44 apiVersion: v1
45 fieldPath: metadata.namespace
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030046 containers:
Julien Barbot8cd94472018-10-23 12:15:31 +020047 - name: {{ include "common.name" . }}-job
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030048 image: {{ .Values.mariadb_image }}
dkamdocs6ad3a1c2018-12-21 09:25:53 +000049 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030050 volumeMounts:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000051 - mountPath: /dbcmd-config/db_cmd.sh
52 name: {{ include "common.fullname" . }}-config
53 subPath: db_cmd.sh
54 - mountPath: /db-config/vid-pre-init.sql
55 name: {{ include "common.fullname" . }}-config
56 subPath: vid-pre-init.sql
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030057 command:
58 - /bin/sh
59 args:
60 - -x
61 - /dbcmd-config/db_cmd.sh
62 env:
63 - name: MYSQL_PASSWORD
Krzysztof Opasiake3519ef2020-03-24 03:25:05 +010064 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 10 }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030065 - name: MYSQL_HOST
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010066 value: {{ index .Values "mariadb-galera" "service" "name" }}
Mandeep Khinda561a91c2018-08-23 14:08:52 +000067 - name: MYSQL_USER
Krzysztof Opasiake3519ef2020-03-24 03:25:05 +010068 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 10 }}
Mandeep Khinda561a91c2018-08-23 14:08:52 +000069 - name: MYSQL_PORT
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010070 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030071 restartPolicy: Never
Mandeep Khinda561a91c2018-08-23 14:08:52 +000072 volumes:
73 - name: {{ include "common.fullname" . }}-config
74 configMap:
75 name: {{ include "common.fullname" . }}
76 items:
77 - key: db_cmd.sh
78 path: db_cmd.sh
79 - key: vid-pre-init.sql
80 path: vid-pre-init.sql