2 # Copyright © 2018 Amdocs, Bell Canada
3 # Modifications Copyright © 2020 AT&T Intellectual Property
4 # Modifications Copyright (C) 2022 Nordix Foundation.
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 {{ if not .Values.global.postgres.localCluster }}
23 name: {{ include "common.fullname" . }}-galera-init
24 namespace: {{ include "common.namespace" . }}
26 app: {{ include "common.name" . }}-galera-init
27 release: {{ include "common.release" . }}
32 app: {{ include "common.name" . }}-galera-init
33 release: {{ include "common.release" . }}
34 name: {{ include "common.name" . }}-galera-init
36 {{- include "common.imagePullSecrets" . | nindent 6 }}
38 {{- if .Values.global.mariadbGalera.localCluster }}
39 {{- if .Values.global.mariadbGalera.useOperator }}
40 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local_operator ) | indent 6 | trim }}
42 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
45 {{- if .Values.global.mariadbGalera.useOperator }}
46 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global_operator ) | indent 6 | trim }}
48 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
52 - name: {{ include "common.name" . }}-galera-config
53 image: {{ include "repositoryGenerator.image.mariadb" . }}
54 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56 - mountPath: /dbcmd-config/db.sh
57 name: {{ include "common.fullname" . }}-config
63 {{- if include "common.onServiceMesh" . }}
64 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
67 - name: MYSQL_ROOT_PASSWORD
68 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 10 }}
70 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
72 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
74 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
75 resources: {{ include "common.resources" . | nindent 10 }}
76 {{- if (include "common.onServiceMesh" .) }}
77 - name: policy-service-mesh-wait-for-job-container
78 image: {{ include "repositoryGenerator.image.quitQuit" . }}
79 imagePullPolicy: Always
84 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
85 /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-config -t 45;
91 fieldPath: metadata.namespace
94 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
96 - name: {{ include "common.fullname" . }}-config
98 name: {{ include "common.fullname" . }}-db-configmap
105 {{ if .Values.global.postgres.localCluster }}
110 name: {{ include "common.fullname" . }}-pg-init
111 namespace: {{ include "common.namespace" . }}
113 app: {{ include "common.name" . }}-pg-init
114 release: {{ include "common.release" . }}
119 app: {{ include "common.name" . }}-pg-init
120 release: {{ include "common.release" . }}
121 name: {{ include "common.name" . }}-pg-init
123 {{- include "common.imagePullSecrets" . | nindent 6 }}
124 initContainers: {{ if .Values.global.postgres.localCluster }}{{ include "common.readinessCheck.waitFor" . | nindent 6 }}{{ end }}
126 - name: {{ include "common.name" . }}-pg-config
127 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.postgresImage }}
128 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
130 - mountPath: /docker-entrypoint-initdb.d/db-pg.sh
131 name: {{ include "common.fullname" . }}-config
137 {{- if include "common.onServiceMesh" . }}
138 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
139 /docker-entrypoint-initdb.d/db-pg.sh
141 - name: PG_ADMIN_PASSWORD
142 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
144 value: "{{ .Values.postgres.service.name2 }}"
146 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
147 - name: PG_USER_PASSWORD
148 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
150 value: "{{ .Values.postgres.service.internalPort }}"
151 resources: {{ include "common.resources" . | nindent 10 }}
152 {{- if (include "common.onServiceMesh" .) }}
153 - name: policy-service-mesh-wait-for-job-container
154 image: {{ include "repositoryGenerator.image.quitQuit" . }}
155 imagePullPolicy: Always
160 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
161 /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-config -t 45;
167 fieldPath: metadata.namespace
170 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
172 - name: {{ include "common.fullname" . }}-config
174 name: {{ include "common.fullname" . }}-db-configmap
182 {{ if not .Values.global.postgres.localCluster }}
186 name: {{ include "common.fullname" . }}-galera-config
187 namespace: {{ include "common.namespace" . }}
189 app: {{ include "common.name" . }}-galera-config
190 release: {{ include "common.release" . }}
195 app: {{ include "common.name" . }}-galera-config
196 release: {{ include "common.release" . }}
197 name: {{ include "common.name" . }}-galera-config
199 {{- include "common.imagePullSecrets" . | nindent 6 }}
201 - name: {{ include "common.name" . }}-init-readiness
202 image: {{ include "repositoryGenerator.image.readiness" . }}
203 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
208 - {{ include "common.fullname" . }}-galera-init
214 fieldPath: metadata.namespace
223 - name: {{ include "common.name" . }}-galera-db-migrator
224 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }}
225 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
227 - mountPath: /dbcmd-config/db_migrator_policy_init.sh
228 name: {{ include "common.fullname" . }}-config
229 subPath: db_migrator_policy_init.sh
234 {{- if include "common.onServiceMesh" . }}
235 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
236 /dbcmd-config/db_migrator_policy_init.sh
239 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
241 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
243 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
245 value: {{ .Values.dbmigrator.schema }}
247 value: {{ .Values.dbmigrator.policy_home }}
248 - name: SCRIPT_DIRECTORY
250 resources: {{ include "common.resources" . | nindent 10 }}
251 {{- if (include "common.onServiceMesh" .) }}
252 - name: policy-service-mesh-wait-for-job-container
253 image: {{ include "repositoryGenerator.image.quitQuit" . }}
254 imagePullPolicy: Always
259 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
260 /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-db-migrator -t 45;
266 fieldPath: metadata.namespace
269 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
271 - name: {{ include "common.fullname" . }}-config
273 name: {{ include "common.fullname" . }}-db-configmap
276 - key: db_migrator_policy_init.sh
277 path: db_migrator_policy_init.sh
279 {{ if .Values.global.postgres.localCluster }}
284 name: {{ include "common.fullname" . }}-pg-config
285 namespace: {{ include "common.namespace" . }}
287 app: {{ include "common.name" . }}-pg-config
288 release: {{ include "common.release" . }}
293 app: {{ include "common.name" . }}-pg-config
294 release: {{ include "common.release" . }}
295 name: {{ include "common.name" . }}-pg-config
297 {{- include "common.imagePullSecrets" . | nindent 6 }}
299 - name: {{ include "common.name" . }}-init-readiness
300 image: {{ include "repositoryGenerator.image.readiness" . }}
301 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
306 - {{ include "common.fullname" . }}-pg-init
312 fieldPath: metadata.namespace
321 - name: {{ include "common.name" . }}-pg-db-migrator
322 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }}
323 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
325 - mountPath: /dbcmd-config/db_migrator_pg_policy_init.sh
326 name: {{ include "common.fullname" . }}-config
327 subPath: db_migrator_pg_policy_init.sh
332 {{- if include "common.onServiceMesh" . }}
333 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
334 /dbcmd-config/db_migrator_pg_policy_init.sh
337 value: "{{ .Values.postgres.service.name2 }}"
339 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
341 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
343 value: {{ .Values.dbmigrator.schema }}
345 value: {{ .Values.dbmigrator.policy_home }}
346 - name: SCRIPT_DIRECTORY
349 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
350 resources: {{ include "common.resources" . | nindent 10 }}
351 {{- if (include "common.onServiceMesh" .) }}
352 - name: policy-service-mesh-wait-for-job-container
353 image: {{ include "repositoryGenerator.image.quitQuit" . }}
354 imagePullPolicy: Always
359 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
360 /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-db-migrator -t 45;
366 fieldPath: metadata.namespace
369 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
371 - name: {{ include "common.fullname" . }}-config
373 name: {{ include "common.fullname" . }}-db-configmap
376 - key: db_migrator_pg_policy_init.sh
377 path: db_migrator_pg_policy_init.sh