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. |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 5 | # Modifications Copyright © 2024 Deutsche Telekom |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
Jakub Latusek | d71d26c | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 18 | */}} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 19 | |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 20 | {{ if not .Values.global.postgres.localCluster }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 21 | apiVersion: batch/v1 |
| 22 | kind: Job |
| 23 | metadata: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 24 | name: {{ include "common.fullname" . }}-galera-init |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 25 | namespace: {{ include "common.namespace" . }} |
| 26 | labels: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 27 | app: {{ include "common.name" . }}-galera-init |
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 | template: |
| 31 | metadata: |
| 32 | labels: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 33 | app: {{ include "common.name" . }}-galera-init |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 34 | release: {{ include "common.release" . }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 35 | name: {{ include "common.name" . }}-galera-init |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 36 | spec: |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 37 | {{ include "common.podSecurityContext" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 38 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 39 | initContainers: |
Andreas Geissler | ee11910 | 2024-04-11 13:53:39 +0200 | [diff] [blame] | 40 | {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_mariadb ) | indent 6 | trim }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 41 | containers: |
| 42 | - name: {{ include "common.name" . }}-galera-config |
Andreas Geissler | a427599 | 2023-01-25 09:27:30 +0100 | [diff] [blame] | 43 | image: {{ include "repositoryGenerator.image.mariadb" . }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 44 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 45 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 46 | volumeMounts: |
| 47 | - mountPath: /dbcmd-config/db.sh |
| 48 | name: {{ include "common.fullname" . }}-config |
| 49 | subPath: db.sh |
| 50 | command: |
| 51 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 52 | - -cx |
| 53 | - | |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 54 | {{- if include "common.requireSidecarKiller" . }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 55 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 56 | /dbcmd-config/db.sh |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 57 | env: |
| 58 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 59 | {{- 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] | 60 | - name: MYSQL_HOST |
| 61 | value: "{{ index .Values "mariadb-galera" "service" "name" }}" |
| 62 | - name: MYSQL_USER |
Krzysztof Opasiak | 98a79cc | 2020-04-01 22:33:58 +0200 | [diff] [blame] | 63 | {{- 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] | 64 | - name: MYSQL_PORT |
| 65 | value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 66 | resources: {{ include "common.resources" . | nindent 10 }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 67 | {{- if (include "common.requireSidecarKiller" .) }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 68 | - name: policy-service-mesh-wait-for-job-container |
| 69 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 70 | imagePullPolicy: Always |
| 71 | command: |
| 72 | - /bin/sh |
| 73 | - "-c" |
| 74 | args: |
| 75 | - echo "waiting 10s for istio side cars to be up"; sleep 10s; |
| 76 | /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-config -t 45; |
| 77 | env: |
| 78 | - name: NAMESPACE |
| 79 | valueFrom: |
| 80 | fieldRef: |
| 81 | apiVersion: v1 |
| 82 | fieldPath: metadata.namespace |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 83 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 84 | resources: |
| 85 | limits: |
| 86 | cpu: 100m |
| 87 | memory: 500Mi |
| 88 | requests: |
| 89 | cpu: 10m |
| 90 | memory: 10Mi |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 91 | {{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 92 | restartPolicy: Never |
| 93 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 94 | volumes: |
| 95 | - name: {{ include "common.fullname" . }}-config |
| 96 | configMap: |
| 97 | name: {{ include "common.fullname" . }}-db-configmap |
| 98 | defaultMode: 0755 |
| 99 | items: |
| 100 | - key: db.sh |
| 101 | path: db.sh |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 102 | {{ end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 103 | |
| 104 | {{ if .Values.global.postgres.localCluster }} |
| 105 | --- |
| 106 | apiVersion: batch/v1 |
| 107 | kind: Job |
| 108 | metadata: |
| 109 | name: {{ include "common.fullname" . }}-pg-init |
| 110 | namespace: {{ include "common.namespace" . }} |
| 111 | labels: |
| 112 | app: {{ include "common.name" . }}-pg-init |
| 113 | release: {{ include "common.release" . }} |
| 114 | spec: |
| 115 | template: |
| 116 | metadata: |
| 117 | labels: |
| 118 | app: {{ include "common.name" . }}-pg-init |
| 119 | release: {{ include "common.release" . }} |
| 120 | name: {{ include "common.name" . }}-pg-init |
| 121 | spec: |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 122 | {{ include "common.podSecurityContext" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 123 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
Andreas Geissler | ee11910 | 2024-04-11 13:53:39 +0200 | [diff] [blame] | 124 | initContainers: |
| 125 | {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_postgres ) | indent 6 | trim }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 126 | containers: |
| 127 | - name: {{ include "common.name" . }}-pg-config |
Andreas Geissler | 6128f5f | 2023-01-25 09:18:56 +0100 | [diff] [blame] | 128 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.postgresImage }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 129 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 130 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 131 | volumeMounts: |
| 132 | - mountPath: /docker-entrypoint-initdb.d/db-pg.sh |
| 133 | name: {{ include "common.fullname" . }}-config |
| 134 | subPath: db-pg.sh |
| 135 | command: |
| 136 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 137 | - -cx |
| 138 | - | |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 139 | {{- if include "common.requireSidecarKiller" . }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 140 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 141 | /docker-entrypoint-initdb.d/db-pg.sh |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 142 | env: |
| 143 | - name: PG_ADMIN_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 144 | {{- 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] | 145 | - name: PG_HOST |
| 146 | value: "{{ .Values.postgres.service.name2 }}" |
| 147 | - name: PG_USER |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 148 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 149 | - name: PG_USER_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 150 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 151 | - name: PG_PORT |
| 152 | value: "{{ .Values.postgres.service.internalPort }}" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 153 | resources: {{ include "common.resources" . | nindent 10 }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 154 | {{- if (include "common.requireSidecarKiller" .) }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 155 | - name: policy-service-mesh-wait-for-job-container |
| 156 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 157 | imagePullPolicy: Always |
| 158 | command: |
| 159 | - /bin/sh |
| 160 | - "-c" |
| 161 | args: |
| 162 | - echo "waiting 10s for istio side cars to be up"; sleep 10s; |
| 163 | /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-config -t 45; |
| 164 | env: |
| 165 | - name: NAMESPACE |
| 166 | valueFrom: |
| 167 | fieldRef: |
| 168 | apiVersion: v1 |
| 169 | fieldPath: metadata.namespace |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 170 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 171 | resources: |
| 172 | limits: |
| 173 | cpu: 100m |
| 174 | memory: 500Mi |
| 175 | requests: |
| 176 | cpu: 10m |
| 177 | memory: 10Mi |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 178 | {{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 179 | restartPolicy: Never |
| 180 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 181 | volumes: |
| 182 | - name: {{ include "common.fullname" . }}-config |
| 183 | configMap: |
| 184 | name: {{ include "common.fullname" . }}-db-configmap |
| 185 | defaultMode: 0755 |
| 186 | items: |
| 187 | - key: db-pg.sh |
| 188 | path: db-pg.sh |
| 189 | {{ end }} |
| 190 | |
| 191 | --- |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 192 | {{ if not .Values.global.postgres.localCluster }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 193 | apiVersion: batch/v1 |
| 194 | kind: Job |
| 195 | metadata: |
| 196 | name: {{ include "common.fullname" . }}-galera-config |
| 197 | namespace: {{ include "common.namespace" . }} |
| 198 | labels: |
| 199 | app: {{ include "common.name" . }}-galera-config |
| 200 | release: {{ include "common.release" . }} |
| 201 | spec: |
| 202 | template: |
| 203 | metadata: |
| 204 | labels: |
| 205 | app: {{ include "common.name" . }}-galera-config |
| 206 | release: {{ include "common.release" . }} |
| 207 | name: {{ include "common.name" . }}-galera-config |
| 208 | spec: |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 209 | {{ include "common.podSecurityContext" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 210 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 211 | initContainers: |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 212 | - name: {{ include "common.name" . }}-init-readiness |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 213 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 214 | image: {{ include "repositoryGenerator.image.readiness" . }} |
| 215 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 216 | command: |
| 217 | - /app/ready.py |
| 218 | args: |
| 219 | - --job-name |
| 220 | - {{ include "common.fullname" . }}-galera-init |
| 221 | env: |
| 222 | - name: NAMESPACE |
| 223 | valueFrom: |
| 224 | fieldRef: |
| 225 | apiVersion: v1 |
| 226 | fieldPath: metadata.namespace |
| 227 | resources: |
| 228 | limits: |
| 229 | cpu: "100m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 230 | memory: "500Mi" |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 231 | requests: |
| 232 | cpu: "3m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 233 | memory: "20Mi" |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 234 | containers: |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 235 | - name: {{ include "common.name" . }}-galera-db-migrator |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 236 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
Andreas Geissler | 8d704ba | 2022-01-07 17:49:22 +0000 | [diff] [blame] | 237 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }} |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 238 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 239 | volumeMounts: |
| 240 | - mountPath: /dbcmd-config/db_migrator_policy_init.sh |
| 241 | name: {{ include "common.fullname" . }}-config |
| 242 | subPath: db_migrator_policy_init.sh |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 243 | - mountPath: /opt/app/policy/etc/db |
| 244 | name: db-conf |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 245 | command: |
| 246 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 247 | - -cx |
| 248 | - | |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 249 | {{- if include "common.requireSidecarKiller" . }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 250 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 251 | /dbcmd-config/db_migrator_policy_init.sh |
jhh | d74fe9f | 2021-04-15 11:04:39 -0500 | [diff] [blame] | 252 | env: |
| 253 | - name: SQL_HOST |
| 254 | value: "{{ index .Values "mariadb-galera" "service" "name" }}" |
| 255 | - name: SQL_USER |
| 256 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
| 257 | - name: SQL_PASSWORD |
| 258 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
| 259 | - name: SQL_DB |
| 260 | value: {{ .Values.dbmigrator.schema }} |
| 261 | - name: POLICY_HOME |
| 262 | value: {{ .Values.dbmigrator.policy_home }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 263 | - name: SCRIPT_DIRECTORY |
| 264 | value: "sql" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 265 | resources: {{ include "common.resources" . | nindent 10 }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 266 | {{- if (include "common.requireSidecarKiller" .) }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 267 | - name: policy-service-mesh-wait-for-job-container |
| 268 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 269 | imagePullPolicy: Always |
| 270 | command: |
| 271 | - /bin/sh |
| 272 | - "-c" |
| 273 | args: |
| 274 | - echo "waiting 10s for istio side cars to be up"; sleep 10s; |
| 275 | /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-db-migrator -t 45; |
| 276 | env: |
| 277 | - name: NAMESPACE |
| 278 | valueFrom: |
| 279 | fieldRef: |
| 280 | apiVersion: v1 |
| 281 | fieldPath: metadata.namespace |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 282 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 283 | resources: |
| 284 | limits: |
| 285 | cpu: 100m |
| 286 | memory: 500Mi |
| 287 | requests: |
| 288 | cpu: 10m |
| 289 | memory: 10Mi |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 290 | {{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 291 | restartPolicy: Never |
| 292 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
| 293 | volumes: |
| 294 | - name: {{ include "common.fullname" . }}-config |
| 295 | configMap: |
| 296 | name: {{ include "common.fullname" . }}-db-configmap |
| 297 | defaultMode: 0755 |
| 298 | items: |
| 299 | - key: db_migrator_policy_init.sh |
| 300 | path: db_migrator_policy_init.sh |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 301 | - name: db-conf |
| 302 | emptyDir: |
| 303 | medium: Memory |
| 304 | sizeLimit: 64Mi |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 305 | {{ end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 306 | {{ if .Values.global.postgres.localCluster }} |
| 307 | --- |
| 308 | apiVersion: batch/v1 |
| 309 | kind: Job |
| 310 | metadata: |
| 311 | name: {{ include "common.fullname" . }}-pg-config |
| 312 | namespace: {{ include "common.namespace" . }} |
| 313 | labels: |
| 314 | app: {{ include "common.name" . }}-pg-config |
| 315 | release: {{ include "common.release" . }} |
| 316 | spec: |
| 317 | template: |
| 318 | metadata: |
| 319 | labels: |
| 320 | app: {{ include "common.name" . }}-pg-config |
| 321 | release: {{ include "common.release" . }} |
| 322 | name: {{ include "common.name" . }}-pg-config |
| 323 | spec: |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 324 | {{ include "common.podSecurityContext" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 325 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 326 | initContainers: |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 327 | - name: {{ include "common.name" . }}-init-readiness |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 328 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 329 | image: {{ include "repositoryGenerator.image.readiness" . }} |
| 330 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 331 | command: |
| 332 | - /app/ready.py |
| 333 | args: |
| 334 | - --job-name |
| 335 | - {{ include "common.fullname" . }}-pg-init |
| 336 | env: |
| 337 | - name: NAMESPACE |
| 338 | valueFrom: |
| 339 | fieldRef: |
| 340 | apiVersion: v1 |
| 341 | fieldPath: metadata.namespace |
| 342 | resources: |
| 343 | limits: |
| 344 | cpu: "100m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 345 | memory: "500Mi" |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 346 | requests: |
| 347 | cpu: "3m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 348 | memory: "20Mi" |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 349 | containers: |
| 350 | - name: {{ include "common.name" . }}-pg-db-migrator |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 351 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 352 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }} |
| 353 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 354 | volumeMounts: |
| 355 | - mountPath: /dbcmd-config/db_migrator_pg_policy_init.sh |
| 356 | name: {{ include "common.fullname" . }}-config |
| 357 | subPath: db_migrator_pg_policy_init.sh |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 358 | - mountPath: /opt/app/policy/etc/db |
| 359 | name: db-conf |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 360 | command: |
| 361 | - /bin/sh |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 362 | - -cx |
| 363 | - | |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 364 | {{- if include "common.requireSidecarKiller" . }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 365 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 366 | /dbcmd-config/db_migrator_pg_policy_init.sh |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 367 | env: |
| 368 | - name: SQL_HOST |
| 369 | value: "{{ .Values.postgres.service.name2 }}" |
| 370 | - name: SQL_USER |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 371 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 372 | - name: SQL_PASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 373 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 374 | - name: SQL_DB |
| 375 | value: {{ .Values.dbmigrator.schema }} |
| 376 | - name: POLICY_HOME |
| 377 | value: {{ .Values.dbmigrator.policy_home }} |
| 378 | - name: SCRIPT_DIRECTORY |
| 379 | value: "postgres" |
| 380 | - name: PGPASSWORD |
saul.gill | ef208b0 | 2023-04-26 16:16:05 +0100 | [diff] [blame] | 381 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 382 | resources: {{ include "common.resources" . | nindent 10 }} |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 383 | {{- if (include "common.requireSidecarKiller" .) }} |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 384 | - name: policy-service-mesh-wait-for-job-container |
| 385 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 386 | imagePullPolicy: Always |
| 387 | command: |
| 388 | - /bin/sh |
| 389 | - "-c" |
| 390 | args: |
| 391 | - echo "waiting 10s for istio side cars to be up"; sleep 10s; |
| 392 | /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-db-migrator -t 45; |
| 393 | env: |
| 394 | - name: NAMESPACE |
| 395 | valueFrom: |
| 396 | fieldRef: |
| 397 | apiVersion: v1 |
| 398 | fieldPath: metadata.namespace |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 399 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 400 | resources: |
| 401 | limits: |
| 402 | cpu: 100m |
| 403 | memory: 500Mi |
| 404 | requests: |
| 405 | cpu: 10m |
| 406 | memory: 10Mi |
Andreas Geissler | c50f089 | 2023-06-14 14:21:31 +0200 | [diff] [blame] | 407 | {{- end }} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 408 | restartPolicy: Never |
farida azmy | c117837 | 2021-04-11 12:55:33 +0200 | [diff] [blame] | 409 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 410 | volumes: |
| 411 | - name: {{ include "common.fullname" . }}-config |
| 412 | configMap: |
| 413 | name: {{ include "common.fullname" . }}-db-configmap |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 414 | defaultMode: 0755 |
Sylvain Desbureaux | 4898dc0 | 2019-11-14 13:35:13 +0100 | [diff] [blame] | 415 | items: |
waynedunican | 368aced | 2022-02-15 08:27:57 +0000 | [diff] [blame] | 416 | - key: db_migrator_pg_policy_init.sh |
| 417 | path: db_migrator_pg_policy_init.sh |
Andreas Geissler | 5768113 | 2024-07-29 10:18:26 +0200 | [diff] [blame] | 418 | - name: db-conf |
| 419 | emptyDir: |
| 420 | medium: Memory |
| 421 | sizeLimit: 64Mi |
amatthews | 736bf37 | 2021-12-14 16:04:15 +0000 | [diff] [blame] | 422 | {{ end }} |