vaibhavjayas | 5ca5465 | 2018-07-31 09:23:16 +0000 | [diff] [blame] | 1 | # Copyright © 2018 Amdocs, Bell Canada |
Krzysztof Opasiak | 4a4703b | 2020-02-08 01:04:48 +0100 | [diff] [blame] | 2 | # Copyright © 2020 Samsung Electronics |
vaibhavjayas | 5ca5465 | 2018-07-31 09:23:16 +0000 | [diff] [blame] | 3 | # |
| 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) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 16 | apiVersion: batch/v1 |
| 17 | kind: Job |
| 18 | metadata: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 19 | name: {{ include "common.fullname" . }}-galera-config |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 20 | namespace: {{ include "common.namespace" . }} |
| 21 | labels: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 22 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 23 | release: {{ include "common.release" . }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 24 | spec: |
| 25 | template: |
| 26 | metadata: |
Hector Anapan-Lavalle | 3d8a6a1 | 2018-08-07 21:31:05 -0400 | [diff] [blame] | 27 | labels: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 28 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 29 | release: {{ include "common.release" . }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 30 | spec: |
| 31 | initContainers: |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 32 | #This container checks that all galera instances are up before initializing it. |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 33 | - name: {{ include "common.name" . }}-readiness |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 34 | image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 35 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 36 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 37 | - /app/ready.py |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 38 | - --container-name |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 39 | - {{ index .Values "mariadb-galera" "service" "name" }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 40 | env: |
| 41 | - name: NAMESPACE |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 42 | valueFrom: |
| 43 | fieldRef: |
| 44 | apiVersion: v1 |
| 45 | fieldPath: metadata.namespace |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 46 | containers: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 47 | - name: {{ include "common.name" . }}-job |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 48 | image: {{ .Values.mariadb_image }} |
dkamdocs | 6ad3a1c | 2018-12-21 09:25:53 +0000 | [diff] [blame] | 49 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 50 | volumeMounts: |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 51 | - 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) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 57 | command: |
| 58 | - /bin/sh |
| 59 | args: |
| 60 | - -x |
| 61 | - /dbcmd-config/db_cmd.sh |
| 62 | env: |
| 63 | - name: MYSQL_PASSWORD |
Krzysztof Opasiak | e3519ef | 2020-03-24 03:25:05 +0100 | [diff] [blame] | 64 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 10 }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 65 | - name: MYSQL_HOST |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 66 | value: {{ index .Values "mariadb-galera" "service" "name" }} |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 67 | - name: MYSQL_USER |
Krzysztof Opasiak | e3519ef | 2020-03-24 03:25:05 +0100 | [diff] [blame] | 68 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 10 }} |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 69 | - name: MYSQL_PORT |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 70 | value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 71 | restartPolicy: Never |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 72 | 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 |