vaibhavjayas | 5ca5465 | 2018-07-31 09:23:16 +0000 | [diff] [blame] | 1 | # Copyright © 2018 Amdocs, Bell Canada |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 15 | apiVersion: batch/v1 |
| 16 | kind: Job |
| 17 | metadata: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 18 | name: {{ include "common.fullname" . }}-galera-config |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 19 | namespace: {{ include "common.namespace" . }} |
| 20 | labels: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 21 | app: {{ include "common.name" . }}-job |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 22 | release: {{ .Release.Name }} |
| 23 | spec: |
| 24 | template: |
| 25 | metadata: |
Hector Anapan-Lavalle | 3d8a6a1 | 2018-08-07 21:31:05 -0400 | [diff] [blame] | 26 | labels: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 27 | app: {{ include "common.name" . }}-job |
Hector Anapan-Lavalle | 3d8a6a1 | 2018-08-07 21:31:05 -0400 | [diff] [blame] | 28 | release: {{ .Release.Name }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 29 | spec: |
| 30 | initContainers: |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 31 | #This container checks that all galera instances are up before initializing it. |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 32 | - name: {{ include "common.name" . }}-readiness |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 33 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 34 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 35 | command: |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 36 | - /root/ready.py |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 37 | - --container-name |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 38 | - {{ index .Values "mariadb-galera" "service" "name" }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 39 | env: |
| 40 | - name: NAMESPACE |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 41 | valueFrom: |
| 42 | fieldRef: |
| 43 | apiVersion: v1 |
| 44 | fieldPath: metadata.namespace |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 45 | containers: |
Julien Barbot | 8cd9447 | 2018-10-23 12:15:31 +0200 | [diff] [blame] | 46 | - name: {{ include "common.name" . }}-job |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 47 | image: {{ .Values.mariadb_image }} |
dkamdocs | 6ad3a1c | 2018-12-21 09:25:53 +0000 | [diff] [blame] | 48 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 49 | volumeMounts: |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 50 | - mountPath: /dbcmd-config/db_cmd.sh |
| 51 | name: {{ include "common.fullname" . }}-config |
| 52 | subPath: db_cmd.sh |
| 53 | - mountPath: /db-config/vid-pre-init.sql |
| 54 | name: {{ include "common.fullname" . }}-config |
| 55 | subPath: vid-pre-init.sql |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 56 | command: |
| 57 | - /bin/sh |
| 58 | args: |
| 59 | - -x |
| 60 | - /dbcmd-config/db_cmd.sh |
| 61 | env: |
| 62 | - name: MYSQL_PASSWORD |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 63 | valueFrom: |
| 64 | secretKeyRef: |
| 65 | name: {{ template "common.fullname" . }}-db |
| 66 | key: db-user-password |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 67 | - name: MYSQL_HOST |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 68 | value: {{ index .Values "mariadb-galera" "service" "name" }} |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 69 | - name: MYSQL_USER |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 70 | value: {{ index .Values "mariadb-galera" "config" "userName" }} |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 71 | - name: MYSQL_PORT |
Sylvain Desbureaux | 6383c44 | 2019-11-14 09:28:12 +0100 | [diff] [blame] | 72 | value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" |
Sonsino, Ofir (os0695) | 2dda01d | 2018-05-30 18:41:14 +0300 | [diff] [blame] | 73 | restartPolicy: Never |
Mandeep Khinda | 561a91c | 2018-08-23 14:08:52 +0000 | [diff] [blame] | 74 | 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 |