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