[COMMON][POSTGRES] Make DB init jobs ServiceMesh compatible 88/129188/3
authorAndreas Geissler <andreas-geissler@telekom.de>
Tue, 10 May 2022 08:30:11 +0000 (10:30 +0200)
committerAndreas Geissler <andreas-geissler@telekom.de>
Tue, 31 May 2022 12:32:31 +0000 (12:32 +0000)
Add wait cycles and sidecar deletion container to ETCD and POSTGRES
init charts

Issue-ID: OOM-2820

Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
Change-Id: Iddc8b7d161dddafe53efb0ce809542a60bd957b8

kubernetes/common/etcd-init/templates/job.yaml
kubernetes/common/etcd-init/values.yaml
kubernetes/common/postgres-init/templates/job.yaml
kubernetes/common/postgres-init/values.yaml

index 69bcfaa..9d7dcc2 100644 (file)
@@ -55,6 +55,8 @@ spec:
           - /bin/sh
           - -ec
           - |
+            {{- if include "common.onServiceMesh" . }}
+            echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
             # Create users
             export ETCDCTL_ENDPOINTS=http://${ETCD_HOST}:${ETCD_PORT}
             export ETCDCTL_API=3
@@ -89,6 +91,7 @@ spec:
           name: localtime
           readOnly: true
         resources: {{ include "common.resources" . | nindent 12 }}
+      {{ include "common.waitForJobContainer" . | indent 6 | trim }}
       {{- if .Values.nodeSelector }}
       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
       {{- end -}}
index c99c9f1..6ccfb3e 100644 (file)
@@ -72,3 +72,7 @@ resources:
       cpu: 20m
       memory: 20Mi
   unlimited: {}
+
+wait_for_job_container:
+  containers:
+    - '{{ include "common.name" . }}'
index 01151bb..d9a7386 100644 (file)
@@ -59,6 +59,8 @@ spec:
           }
           export PG_PASSWORD=`prepare_password $PG_PASSWORD_INPUT`;
           export PG_ROOT_PASSWORD=`prepare_password $PG_ROOT_PASSWORD_INPUT`;
+          {{- if include "common.onServiceMesh" . }}
+          echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
           cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done;
           psql "postgresql://postgres:$PG_ROOT_PASSWORD@$PG_HOST" < /config/setup.sql
         env:
@@ -98,6 +100,7 @@ spec:
           name: pgconf
         resources:
 {{ include "common.resources" . | indent 12 }}
+      {{ include "common.waitForJobContainer" . | indent 6 | trim }}
       {{- if .Values.nodeSelector }}
       nodeSelector:
 {{ toYaml .Values.nodeSelector | indent 10 }}
index 7bcd8e2..d6d51f0 100644 (file)
@@ -89,3 +89,7 @@ resources:
       cpu: 1
       memory: 2Gi
   unlimited: {}
+
+wait_for_job_container:
+  containers:
+    - '{{ include "common.name" . }}-update-config'
\ No newline at end of file