Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [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 | |
| 15 | apiVersion: batch/v1 |
| 16 | kind: Job |
| 17 | metadata: |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 18 | name: {{ include "common.release" . }}-galera-config |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 19 | namespace: {{ include "common.namespace" . }} |
| 20 | labels: |
| 21 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 22 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 23 | spec: |
| 24 | template: |
| 25 | metadata: |
| 26 | labels: |
| 27 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 28 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 29 | spec: |
| 30 | initContainers: |
| 31 | #This container checks that all galera instances are up before initializing it. |
| 32 | - name: {{ include "common.name" . }}-readiness |
| 33 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 34 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 35 | command: |
| 36 | - /root/ready.py |
| 37 | - --container-name |
| 38 | - {{ index .Values "mariadb-galera" "service" "name" }} |
| 39 | env: |
| 40 | - name: NAMESPACE |
| 41 | valueFrom: |
| 42 | fieldRef: |
| 43 | apiVersion: v1 |
| 44 | fieldPath: metadata.namespace |
| 45 | containers: |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 46 | - name: {{ include "common.release" . }}-galera-config |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 47 | image: {{ .Values.mariadb_image }} |
| 48 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 49 | volumeMounts: |
| 50 | - mountPath: /dbcmd-config/db.sh |
| 51 | name: {{ include "common.fullname" . }}-config |
| 52 | subPath: db.sh |
| 53 | command: |
| 54 | - /bin/sh |
| 55 | args: |
| 56 | - -x |
| 57 | - /dbcmd-config/db.sh |
| 58 | env: |
| 59 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 10 }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 61 | - name: MYSQL_HOST |
| 62 | value: "{{ index .Values "mariadb-galera" "service" "name" }}" |
| 63 | - name: MYSQL_USER |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 64 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 65 | - name: MYSQL_PORT |
| 66 | value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" |
| 67 | restartPolicy: Never |
| 68 | volumes: |
| 69 | - name: {{ include "common.fullname" . }}-config |
| 70 | configMap: |
| 71 | name: {{ include "common.fullname" . }}-db-configmap |
| 72 | items: |
| 73 | - key: db.sh |
| 74 | path: db.sh |