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