Jakub Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 1 | {{/* |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 2 | # Copyright © 2019 Orange |
Krzysztof Opasiak | f54d668 | 2020-01-08 18:35:44 +0100 | [diff] [blame] | 3 | # Copyright © 2020 Samsung Electronics |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 4 | # |
| 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 Latusek | 3659d9f | 2020-09-14 16:21:55 +0200 | [diff] [blame] | 16 | */}} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 17 | |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 18 | {{ include "mariadbInit._updateSecrets" . -}} |
| 19 | |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 20 | apiVersion: batch/v1 |
| 21 | kind: Job |
| 22 | metadata: |
| 23 | name: {{ include "common.fullname" . }}-config-job |
| 24 | namespace: {{ include "common.namespace" . }} |
| 25 | labels: |
| 26 | app: {{ include "common.name" . }} |
| 27 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 28 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 29 | heritage: {{ .Release.Service }} |
| 30 | spec: |
| 31 | backoffLimit: 20 |
| 32 | template: |
| 33 | metadata: |
| 34 | labels: |
| 35 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 36 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 37 | name: {{ include "common.name" . }} |
| 38 | spec: |
| 39 | initContainers: |
| 40 | - name: {{ include "common.name" . }}-readiness |
| 41 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 42 | - /app/ready.py |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 43 | args: |
Andreas Geissler | cfd8434 | 2023-08-16 17:18:49 +0200 | [diff] [blame] | 44 | - --app-name |
Krzysztof Opasiak | 80e39d4 | 2020-08-31 22:25:52 +0200 | [diff] [blame] | 45 | - {{ default .Values.global.mariadbGalera.nameOverride .Values.mariadbGalera.containerName }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 46 | env: |
| 47 | - name: NAMESPACE |
| 48 | valueFrom: |
| 49 | fieldRef: |
| 50 | apiVersion: v1 |
| 51 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 72bbabf | 2020-11-19 17:15:14 +0100 | [diff] [blame] | 52 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 53 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 54 | resources: |
| 55 | limits: |
| 56 | cpu: "100m" |
| 57 | memory: "0.5Gi" |
| 58 | requests: |
| 59 | cpu: "3m" |
| 60 | memory: "0.02Gi" |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 61 | containers: |
| 62 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 72bbabf | 2020-11-19 17:15:14 +0100 | [diff] [blame] | 63 | image: {{ include "repositoryGenerator.image.mariadb" . }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 64 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 65 | command: |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 66 | - /bin/sh |
| 67 | - -c |
| 68 | - | |
Andreas Geissler | ba1200c | 2022-04-07 17:02:59 +0200 | [diff] [blame] | 69 | {{- if include "common.onServiceMesh" . }} |
| 70 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 71 | /db_init/db_init.sh {{ if or .Values.dbScriptConfigMap .Values.dbScript }} && |
| 72 | /db_config/db_cmd.sh{{ end }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 73 | env: |
| 74 | - name: DB_HOST |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 75 | value: {{ include "common.mariadbService" . }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 76 | - name: DB_PORT |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 77 | value: {{ include "common.mariadbPort" . | quote }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 78 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 79 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-password" "key" (default "password" .Values.global.mariadbGalera.userRootSecretKey)) | indent 10 }} |
Krzysztof Opasiak | f54d668 | 2020-01-08 18:35:44 +0100 | [diff] [blame] | 80 | - name: {{ printf "MYSQL_USER_%s" .Values.config.mysqlDatabase | upper }} |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 81 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" .Values.config.mysqlDatabase "key" "login") | indent 10 }} |
Krzysztof Opasiak | f54d668 | 2020-01-08 18:35:44 +0100 | [diff] [blame] | 82 | - name: {{ printf "MYSQL_PASSWORD_%s" .Values.config.mysqlDatabase | upper }} |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 83 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" .Values.config.mysqlDatabase "key" "password") | indent 10 }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 84 | {{- $root := . }} |
Krzysztof Opasiak | d732244 | 2020-01-30 12:10:40 +0100 | [diff] [blame] | 85 | {{ range $db, $_values := .Values.config.mysqlAdditionalDatabases }} |
Krzysztof Opasiak | f54d668 | 2020-01-08 18:35:44 +0100 | [diff] [blame] | 86 | - name: {{ printf "MYSQL_USER_%s" $db | upper }} |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 87 | {{- include "common.secret.envFromSecretFast" (dict "global" $root "uid" $db "key" "login") | indent 10 }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 88 | - name: {{ printf "MYSQL_PASSWORD_%s" $db | upper }} |
Krzysztof Opasiak | ed7b049 | 2020-09-01 18:35:40 +0200 | [diff] [blame] | 89 | {{- include "common.secret.envFromSecretFast" (dict "global" $root "uid" $db "key" "password") | indent 10 }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 90 | {{ end }} |
| 91 | volumeMounts: |
| 92 | - mountPath: /etc/localtime |
| 93 | name: localtime |
| 94 | readOnly: true |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 95 | - name: mariadb-init |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 96 | mountPath: /db_init/ |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 97 | {{- if or .Values.dbScriptConfigMap .Values.dbScript }} |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 98 | - name: mariadb-conf |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 99 | mountPath: /db_config/ |
| 100 | {{- end }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 101 | resources: {{ include "common.resources" . | nindent 10 }} |
Andreas Geissler | ba1200c | 2022-04-07 17:02:59 +0200 | [diff] [blame] | 102 | {{ include "common.waitForJobContainer" . | indent 6 | trim }} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 103 | {{- if .Values.nodeSelector }} |
| 104 | nodeSelector: |
| 105 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 106 | {{- end -}} |
| 107 | {{- if .Values.affinity }} |
| 108 | affinity: |
| 109 | {{ toYaml .Values.affinity | indent 10 }} |
| 110 | {{- end }} |
vladimir turok | d804418 | 2023-07-27 16:28:36 +0200 | [diff] [blame] | 111 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 112 | volumes: |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 113 | - name: localtime |
| 114 | hostPath: |
| 115 | path: /etc/localtime |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 116 | {{- if or .Values.dbScriptConfigMap .Values.dbScript }} |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 117 | - name: mariadb-conf |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 118 | configMap: |
| 119 | {{- if .Values.dbScriptConfigMap }} |
| 120 | name: {{ tpl .Values.dbScriptConfigMap . }} |
| 121 | {{- else -}} |
| 122 | name: {{ include "common.fullname" . }}-dbscript |
| 123 | {{- end }} |
| 124 | defaultMode: 0755 |
| 125 | {{- end }} |
Mahmoud Abdelhamid | e351f51 | 2021-05-04 17:52:04 +0200 | [diff] [blame] | 126 | - name: mariadb-init |
RPMishra | e4ee7f1 | 2020-10-07 12:09:01 +0530 | [diff] [blame] | 127 | configMap: |
| 128 | name: {{ include "mariadbInit.configMap" . }} |
| 129 | defaultMode: 0755 |
Sylvain Desbureaux | 1d061a4 | 2019-11-08 15:27:20 +0100 | [diff] [blame] | 130 | restartPolicy: Never |
| 131 | imagePullSecrets: |
| 132 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |