Jakub Latusek | d71d26c | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 1 | {{/* |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 2 | # Copyright © 2018 Amdocs, Bell Canada |
jhh | d425867 | 2020-08-09 12:08:08 -0500 | [diff] [blame] | 3 | # Modifications Copyright © 2020 AT&T Intellectual Property |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 4 | # Modifications Copyright (C) 2022 Nordix Foundation. |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
Jakub Latusek | d71d26c | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 17 | */}} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 18 | |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 19 | {{ if not .Values.global.postgres.localCluster }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 20 | apiVersion: batch/v1 |
| 21 | kind: Job |
| 22 | metadata: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 23 | name: {{ include "common.fullname" . }}-galera-init |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 24 | namespace: {{ include "common.namespace" . }} |
| 25 | labels: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 26 | app: {{ include "common.name" . }}-galera-init |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 27 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 28 | spec: |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 32 | app: {{ include "common.name" . }}-galera-init |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 33 | release: {{ include "common.release" . }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 34 | name: {{ include "common.name" . }}-galera-init |
Andreas Geissler | f10c555 | 2023-03-21 18:09:46 +0100 | [diff] [blame] | 35 | annotations: |
| 36 | sidecar.istio.io/inject: "false" |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 37 | spec: |
andreas-geissler | 7d85f3f | 2021-07-19 17:53:22 +0200 | [diff] [blame] | 38 | imagePullSecrets: |
| 39 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 40 | initContainers: |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 41 | - name: {{ include "common.name" . }}-mariadb-readiness |
Sylvain Desbureaux | 7c8c686 | 2020-11-19 18:02:37 +0100 | [diff] [blame] | 42 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 43 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 44 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 45 | - /app/ready.py |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 46 | - --container-name |
| 47 | - {{ index .Values "mariadb-galera" "service" "name" }} |
| 48 | env: |
| 49 | - name: NAMESPACE |
| 50 | valueFrom: |
| 51 | fieldRef: |
| 52 | apiVersion: v1 |
| 53 | fieldPath: metadata.namespace |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 54 | containers: |
| 55 | - name: {{ include "common.name" . }}-galera-config |
Andreas Geissler | a427599 | 2023-01-25 09:27:30 +0100 | [diff] [blame] | 56 | image: {{ include "repositoryGenerator.image.mariadb" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 57 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 58 | volumeMounts: |
| 59 | - mountPath: /dbcmd-config/db.sh |
| 60 | name: {{ include "common.fullname" . }}-config |
| 61 | subPath: db.sh |
| 62 | command: |
| 63 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 64 | - -cx |
| 65 | - | |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 66 | /dbcmd-config/db.sh |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 67 | env: |
| 68 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 69 | {{- 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] | 70 | - name: MYSQL_HOST |
| 71 | value: "{{ index .Values "mariadb-galera" "service" "name" }}" |
| 72 | - name: MYSQL_USER |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 73 | {{- 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] | 74 | - name: MYSQL_PORT |
| 75 | value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 76 | resources: {{ include "common.resources" . | nindent 10 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 77 | restartPolicy: Never |
| 78 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 79 | volumes: |
| 80 | - name: {{ include "common.fullname" . }}-config |
| 81 | configMap: |
| 82 | name: {{ include "common.fullname" . }}-db-configmap |
| 83 | defaultMode: 0755 |
| 84 | items: |
| 85 | - key: db.sh |
| 86 | path: db.sh |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 87 | {{ end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 88 | |
| 89 | {{ if .Values.global.postgres.localCluster }} |
| 90 | --- |
| 91 | apiVersion: batch/v1 |
| 92 | kind: Job |
| 93 | metadata: |
| 94 | name: {{ include "common.fullname" . }}-pg-init |
| 95 | namespace: {{ include "common.namespace" . }} |
| 96 | labels: |
| 97 | app: {{ include "common.name" . }}-pg-init |
| 98 | release: {{ include "common.release" . }} |
| 99 | spec: |
| 100 | template: |
| 101 | metadata: |
| 102 | labels: |
| 103 | app: {{ include "common.name" . }}-pg-init |
| 104 | release: {{ include "common.release" . }} |
| 105 | name: {{ include "common.name" . }}-pg-init |
Andreas Geissler | f10c555 | 2023-03-21 18:09:46 +0100 | [diff] [blame] | 106 | annotations: |
| 107 | sidecar.istio.io/inject: "false" |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 108 | spec: |
| 109 | imagePullSecrets: |
| 110 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 111 | initContainers: {{ if .Values.global.postgres.localCluster }}{{ include "common.readinessCheck.waitFor" . | nindent 6 }}{{ end }} |
| 112 | containers: |
| 113 | - name: {{ include "common.name" . }}-pg-config |
Andreas Geissler | 6128f5f | 2023-01-25 09:18:56 +0100 | [diff] [blame] | 114 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.postgresImage }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 115 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 116 | volumeMounts: |
| 117 | - mountPath: /docker-entrypoint-initdb.d/db-pg.sh |
| 118 | name: {{ include "common.fullname" . }}-config |
| 119 | subPath: db-pg.sh |
| 120 | command: |
| 121 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 122 | - -cx |
| 123 | - | |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 124 | /docker-entrypoint-initdb.d/db-pg.sh |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 125 | env: |
| 126 | - name: PG_ADMIN_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 127 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 128 | - name: PG_HOST |
| 129 | value: "{{ .Values.postgres.service.name2 }}" |
| 130 | - name: PG_USER |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 131 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 132 | - name: PG_USER_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 133 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 134 | - name: PG_PORT |
| 135 | value: "{{ .Values.postgres.service.internalPort }}" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 136 | resources: {{ include "common.resources" . | nindent 10 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 137 | restartPolicy: Never |
| 138 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 139 | volumes: |
| 140 | - name: {{ include "common.fullname" . }}-config |
| 141 | configMap: |
| 142 | name: {{ include "common.fullname" . }}-db-configmap |
| 143 | defaultMode: 0755 |
| 144 | items: |
| 145 | - key: db-pg.sh |
| 146 | path: db-pg.sh |
| 147 | {{ end }} |
| 148 | |
| 149 | --- |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 150 | {{ if not .Values.global.postgres.localCluster }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 151 | apiVersion: batch/v1 |
| 152 | kind: Job |
| 153 | metadata: |
| 154 | name: {{ include "common.fullname" . }}-galera-config |
| 155 | namespace: {{ include "common.namespace" . }} |
| 156 | labels: |
| 157 | app: {{ include "common.name" . }}-galera-config |
| 158 | release: {{ include "common.release" . }} |
| 159 | spec: |
| 160 | template: |
| 161 | metadata: |
| 162 | labels: |
| 163 | app: {{ include "common.name" . }}-galera-config |
| 164 | release: {{ include "common.release" . }} |
| 165 | name: {{ include "common.name" . }}-galera-config |
Andreas Geissler | f10c555 | 2023-03-21 18:09:46 +0100 | [diff] [blame] | 166 | annotations: |
| 167 | sidecar.istio.io/inject: "false" |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 168 | spec: |
| 169 | imagePullSecrets: |
| 170 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 171 | initContainers: |
| 172 | - name: {{ include "common.name" . }}-init-readiness |
| 173 | image: {{ include "repositoryGenerator.image.readiness" . }} |
| 174 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 175 | command: |
| 176 | - /app/ready.py |
| 177 | args: |
| 178 | - --job-name |
| 179 | - {{ include "common.fullname" . }}-galera-init |
| 180 | env: |
| 181 | - name: NAMESPACE |
| 182 | valueFrom: |
| 183 | fieldRef: |
| 184 | apiVersion: v1 |
| 185 | fieldPath: metadata.namespace |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 186 | containers: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 187 | - name: {{ include "common.name" . }}-galera-db-migrator |
Andreas Geissler | 8d704ba | 2022-01-07 17:49:22 +0000 | [diff] [blame] | 188 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }} |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 189 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 190 | volumeMounts: |
| 191 | - mountPath: /dbcmd-config/db_migrator_policy_init.sh |
| 192 | name: {{ include "common.fullname" . }}-config |
| 193 | subPath: db_migrator_policy_init.sh |
| 194 | command: |
| 195 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 196 | - -cx |
| 197 | - | |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 198 | /dbcmd-config/db_migrator_policy_init.sh |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 199 | env: |
| 200 | - name: SQL_HOST |
| 201 | value: "{{ index .Values "mariadb-galera" "service" "name" }}" |
| 202 | - name: SQL_USER |
| 203 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
| 204 | - name: SQL_PASSWORD |
| 205 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
| 206 | - name: SQL_DB |
| 207 | value: {{ .Values.dbmigrator.schema }} |
| 208 | - name: POLICY_HOME |
| 209 | value: {{ .Values.dbmigrator.policy_home }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 210 | - name: SCRIPT_DIRECTORY |
| 211 | value: "sql" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 212 | resources: {{ include "common.resources" . | nindent 10 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 213 | restartPolicy: Never |
| 214 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 215 | volumes: |
| 216 | - name: {{ include "common.fullname" . }}-config |
| 217 | configMap: |
| 218 | name: {{ include "common.fullname" . }}-db-configmap |
| 219 | defaultMode: 0755 |
| 220 | items: |
| 221 | - key: db_migrator_policy_init.sh |
| 222 | path: db_migrator_policy_init.sh |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 223 | {{ end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 224 | {{ if .Values.global.postgres.localCluster }} |
| 225 | --- |
| 226 | apiVersion: batch/v1 |
| 227 | kind: Job |
| 228 | metadata: |
| 229 | name: {{ include "common.fullname" . }}-pg-config |
| 230 | namespace: {{ include "common.namespace" . }} |
| 231 | labels: |
| 232 | app: {{ include "common.name" . }}-pg-config |
| 233 | release: {{ include "common.release" . }} |
| 234 | spec: |
| 235 | template: |
| 236 | metadata: |
| 237 | labels: |
| 238 | app: {{ include "common.name" . }}-pg-config |
| 239 | release: {{ include "common.release" . }} |
| 240 | name: {{ include "common.name" . }}-pg-config |
Andreas Geissler | f10c555 | 2023-03-21 18:09:46 +0100 | [diff] [blame] | 241 | annotations: |
| 242 | sidecar.istio.io/inject: "false" |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 243 | spec: |
| 244 | imagePullSecrets: |
| 245 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 246 | initContainers: |
| 247 | - name: {{ include "common.name" . }}-init-readiness |
| 248 | image: {{ include "repositoryGenerator.image.readiness" . }} |
| 249 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 250 | command: |
| 251 | - /app/ready.py |
| 252 | args: |
| 253 | - --job-name |
| 254 | - {{ include "common.fullname" . }}-pg-init |
| 255 | env: |
| 256 | - name: NAMESPACE |
| 257 | valueFrom: |
| 258 | fieldRef: |
| 259 | apiVersion: v1 |
| 260 | fieldPath: metadata.namespace |
| 261 | containers: |
| 262 | - name: {{ include "common.name" . }}-pg-db-migrator |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 263 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }} |
| 264 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 265 | volumeMounts: |
| 266 | - mountPath: /dbcmd-config/db_migrator_pg_policy_init.sh |
| 267 | name: {{ include "common.fullname" . }}-config |
| 268 | subPath: db_migrator_pg_policy_init.sh |
| 269 | command: |
| 270 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 271 | - -cx |
| 272 | - | |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 273 | /dbcmd-config/db_migrator_pg_policy_init.sh |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 274 | env: |
| 275 | - name: SQL_HOST |
| 276 | value: "{{ .Values.postgres.service.name2 }}" |
| 277 | - name: SQL_USER |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 278 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 279 | - name: SQL_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 280 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 281 | - name: SQL_DB |
| 282 | value: {{ .Values.dbmigrator.schema }} |
| 283 | - name: POLICY_HOME |
| 284 | value: {{ .Values.dbmigrator.policy_home }} |
| 285 | - name: SCRIPT_DIRECTORY |
| 286 | value: "postgres" |
| 287 | - name: PGPASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 288 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 289 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 290 | restartPolicy: Never |
farida azmy | c117837 | 2021-04-11 12:55:33 +0200 | [diff] [blame] | 291 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 292 | volumes: |
| 293 | - name: {{ include "common.fullname" . }}-config |
| 294 | configMap: |
| 295 | name: {{ include "common.fullname" . }}-db-configmap |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 296 | defaultMode: 0755 |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 297 | items: |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 298 | - key: db_migrator_pg_policy_init.sh |
| 299 | path: db_migrator_pg_policy_init.sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 300 | {{ end }} |