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 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_mariadb ) | indent 6 | trim }}
40 - name: {{ include "common.name" . }}-galera-config
41 image: {{ include "repositoryGenerator.image.mariadb" . }}
42 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44 - mountPath: /dbcmd-config/db.sh
45 name: {{ include "common.fullname" . }}-config
51 {{- if include "common.onServiceMesh" . }}
52 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
55 - name: MYSQL_ROOT_PASSWORD
56 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 10 }}
58 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
60 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
62 value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
63 resources: {{ include "common.resources" . | nindent 10 }}
64 {{- if (include "common.onServiceMesh" .) }}
65 - name: policy-service-mesh-wait-for-job-container
66 image: {{ include "repositoryGenerator.image.quitQuit" . }}
67 imagePullPolicy: Always
72 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
73 /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-config -t 45;
79 fieldPath: metadata.namespace
82 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
84 - name: {{ include "common.fullname" . }}-config
86 name: {{ include "common.fullname" . }}-db-configmap
93 {{ if .Values.global.postgres.localCluster }}
98 name: {{ include "common.fullname" . }}-pg-init
99 namespace: {{ include "common.namespace" . }}
101 app: {{ include "common.name" . }}-pg-init
102 release: {{ include "common.release" . }}
107 app: {{ include "common.name" . }}-pg-init
108 release: {{ include "common.release" . }}
109 name: {{ include "common.name" . }}-pg-init
111 {{- include "common.imagePullSecrets" . | nindent 6 }}
113 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_postgres ) | indent 6 | trim }}
115 - name: {{ include "common.name" . }}-pg-config
116 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.postgresImage }}
117 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
119 - mountPath: /docker-entrypoint-initdb.d/db-pg.sh
120 name: {{ include "common.fullname" . }}-config
126 {{- if include "common.onServiceMesh" . }}
127 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
128 /docker-entrypoint-initdb.d/db-pg.sh
130 - name: PG_ADMIN_PASSWORD
131 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
133 value: "{{ .Values.postgres.service.name2 }}"
135 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
136 - name: PG_USER_PASSWORD
137 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
139 value: "{{ .Values.postgres.service.internalPort }}"
140 resources: {{ include "common.resources" . | nindent 10 }}
141 {{- if (include "common.onServiceMesh" .) }}
142 - name: policy-service-mesh-wait-for-job-container
143 image: {{ include "repositoryGenerator.image.quitQuit" . }}
144 imagePullPolicy: Always
149 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
150 /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-config -t 45;
156 fieldPath: metadata.namespace
159 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
161 - name: {{ include "common.fullname" . }}-config
163 name: {{ include "common.fullname" . }}-db-configmap
171 {{ if not .Values.global.postgres.localCluster }}
175 name: {{ include "common.fullname" . }}-galera-config
176 namespace: {{ include "common.namespace" . }}
178 app: {{ include "common.name" . }}-galera-config
179 release: {{ include "common.release" . }}
184 app: {{ include "common.name" . }}-galera-config
185 release: {{ include "common.release" . }}
186 name: {{ include "common.name" . }}-galera-config
188 {{- include "common.imagePullSecrets" . | nindent 6 }}
190 - name: {{ include "common.name" . }}-init-readiness
191 image: {{ include "repositoryGenerator.image.readiness" . }}
192 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
197 - {{ include "common.fullname" . }}-galera-init
203 fieldPath: metadata.namespace
212 - name: {{ include "common.name" . }}-galera-db-migrator
213 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }}
214 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
216 - mountPath: /dbcmd-config/db_migrator_policy_init.sh
217 name: {{ include "common.fullname" . }}-config
218 subPath: db_migrator_policy_init.sh
223 {{- if include "common.onServiceMesh" . }}
224 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
225 /dbcmd-config/db_migrator_policy_init.sh
228 value: "{{ index .Values "mariadb-galera" "service" "name" }}"
230 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
232 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
234 value: {{ .Values.dbmigrator.schema }}
236 value: {{ .Values.dbmigrator.policy_home }}
237 - name: SCRIPT_DIRECTORY
239 resources: {{ include "common.resources" . | nindent 10 }}
240 {{- if (include "common.onServiceMesh" .) }}
241 - name: policy-service-mesh-wait-for-job-container
242 image: {{ include "repositoryGenerator.image.quitQuit" . }}
243 imagePullPolicy: Always
248 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
249 /app/ready.py --service-mesh-check {{ include "common.name" . }}-galera-db-migrator -t 45;
255 fieldPath: metadata.namespace
258 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
260 - name: {{ include "common.fullname" . }}-config
262 name: {{ include "common.fullname" . }}-db-configmap
265 - key: db_migrator_policy_init.sh
266 path: db_migrator_policy_init.sh
268 {{ if .Values.global.postgres.localCluster }}
273 name: {{ include "common.fullname" . }}-pg-config
274 namespace: {{ include "common.namespace" . }}
276 app: {{ include "common.name" . }}-pg-config
277 release: {{ include "common.release" . }}
282 app: {{ include "common.name" . }}-pg-config
283 release: {{ include "common.release" . }}
284 name: {{ include "common.name" . }}-pg-config
286 {{- include "common.imagePullSecrets" . | nindent 6 }}
288 - name: {{ include "common.name" . }}-init-readiness
289 image: {{ include "repositoryGenerator.image.readiness" . }}
290 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
295 - {{ include "common.fullname" . }}-pg-init
301 fieldPath: metadata.namespace
310 - name: {{ include "common.name" . }}-pg-db-migrator
311 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbmigrator.image }}
312 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
314 - mountPath: /dbcmd-config/db_migrator_pg_policy_init.sh
315 name: {{ include "common.fullname" . }}-config
316 subPath: db_migrator_pg_policy_init.sh
321 {{- if include "common.onServiceMesh" . }}
322 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
323 /dbcmd-config/db_migrator_pg_policy_init.sh
326 value: "{{ .Values.postgres.service.name2 }}"
328 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
330 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
332 value: {{ .Values.dbmigrator.schema }}
334 value: {{ .Values.dbmigrator.policy_home }}
335 - name: SCRIPT_DIRECTORY
338 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
339 resources: {{ include "common.resources" . | nindent 10 }}
340 {{- if (include "common.onServiceMesh" .) }}
341 - name: policy-service-mesh-wait-for-job-container
342 image: {{ include "repositoryGenerator.image.quitQuit" . }}
343 imagePullPolicy: Always
348 - echo "waiting 10s for istio side cars to be up"; sleep 10s;
349 /app/ready.py --service-mesh-check {{ include "common.name" . }}-pg-db-migrator -t 45;
355 fieldPath: metadata.namespace
358 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
360 - name: {{ include "common.fullname" . }}-config
362 name: {{ include "common.fullname" . }}-db-configmap
365 - key: db_migrator_pg_policy_init.sh
366 path: db_migrator_pg_policy_init.sh