blob: b051cdec369d7c1595273de20f354fbe919f0b6d [file] [log] [blame]
Jakub Latusekd9c241b2020-10-21 13:36:30 +02001{{/*
vaibhavjayas5ca54652018-07-31 09:23:16 +00002# Copyright © 2018 Amdocs, Bell Canada
Krzysztof Opasiak4a4703b2020-02-08 01:04:48 +01003# Copyright © 2020 Samsung Electronics
vaibhavjayas5ca54652018-07-31 09:23:16 +00004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
Jakub Latusekd9c241b2020-10-21 13:36:30 +020016*/}}
vaibhavjayas5ca54652018-07-31 09:23:16 +000017
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030018apiVersion: batch/v1
19kind: Job
20metadata:
Julien Barbot8cd94472018-10-23 12:15:31 +020021 name: {{ include "common.fullname" . }}-galera-config
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030022 namespace: {{ include "common.namespace" . }}
23 labels:
Julien Barbot8cd94472018-10-23 12:15:31 +020024 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010025 release: {{ include "common.release" . }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030026spec:
27 template:
28 metadata:
Hector Anapan-Lavalle3d8a6a12018-08-07 21:31:05 -040029 labels:
Julien Barbot8cd94472018-10-23 12:15:31 +020030 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010031 release: {{ include "common.release" . }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030032 spec:
33 initContainers:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000034#This container checks that all galera instances are up before initializing it.
Julien Barbot8cd94472018-10-23 12:15:31 +020035 - name: {{ include "common.name" . }}-readiness
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020036 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030037 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030038 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020039 - /app/ready.py
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030040 - --container-name
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010041 - {{ index .Values "mariadb-galera" "service" "name" }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030042 env:
43 - name: NAMESPACE
Mandeep Khinda561a91c2018-08-23 14:08:52 +000044 valueFrom:
45 fieldRef:
46 apiVersion: v1
47 fieldPath: metadata.namespace
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030048 containers:
Julien Barbot8cd94472018-10-23 12:15:31 +020049 - name: {{ include "common.name" . }}-job
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030050 image: {{ .Values.mariadb_image }}
dkamdocs6ad3a1c2018-12-21 09:25:53 +000051 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030052 volumeMounts:
Mandeep Khinda561a91c2018-08-23 14:08:52 +000053 - mountPath: /dbcmd-config/db_cmd.sh
54 name: {{ include "common.fullname" . }}-config
55 subPath: db_cmd.sh
56 - mountPath: /db-config/vid-pre-init.sql
57 name: {{ include "common.fullname" . }}-config
58 subPath: vid-pre-init.sql
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030059 command:
60 - /bin/sh
61 args:
62 - -x
63 - /dbcmd-config/db_cmd.sh
64 env:
65 - name: MYSQL_PASSWORD
Krzysztof Opasiake3519ef2020-03-24 03:25:05 +010066 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 10 }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030067 - name: MYSQL_HOST
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010068 value: {{ index .Values "mariadb-galera" "service" "name" }}
Mandeep Khinda561a91c2018-08-23 14:08:52 +000069 - name: MYSQL_USER
Krzysztof Opasiake3519ef2020-03-24 03:25:05 +010070 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 10 }}
Mandeep Khinda561a91c2018-08-23 14:08:52 +000071 - name: MYSQL_PORT
Sylvain Desbureaux6383c442019-11-14 09:28:12 +010072 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030073 restartPolicy: Never
Mandeep Khinda561a91c2018-08-23 14:08:52 +000074 volumes:
75 - name: {{ include "common.fullname" . }}-config
76 configMap:
77 name: {{ include "common.fullname" . }}
78 items:
79 - key: db_cmd.sh
80 path: db_cmd.sh
81 - key: vid-pre-init.sql
82 path: vid-pre-init.sql