Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / sdnc / templates / sdnrdb-init-job.yaml
index 42b3f25..665e16c 100755 (executable)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2020 highstreet technologies GmbH
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 {{ if .Values.config.sdnr.enabled -}}
 apiVersion: batch/v1
 kind: Job
@@ -24,7 +26,7 @@ spec:
       {{ include "common.certInitializer.initContainer" . | indent 6 }}
       {{ if .Values.global.aafEnabled }}
       - name: {{ include "common.name" . }}-chown
-        image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}"]
         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
       {{ end }}
@@ -44,14 +46,17 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
       containers:
       - name: {{ include "common.name" . }}-sdnrdb-init-job
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         command: ["/bin/bash"]
-        args: ["-c", "{{ .Values.config.binDir }}/startODL.sh"]
+        args:
+          - -c
+          - |
+            sleep 90; "{{ .Values.config.binDir }}/startODL.sh"
         env:
           - name: SDNC_AAF_ENABLED
             value: "{{ .Values.global.aafEnabled}}"
@@ -74,6 +79,24 @@ spec:
             value: "-k"
         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
         resources: {{ include "common.resources" . | nindent 12 }}
+      {{- if include "common.onServiceMesh" . }}
+      - name: sdnrdb-service-mesh-wait-for-job-container
+        image: {{ include "repositoryGenerator.image.quitQuit" . }}
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        command:
+          - /bin/sh
+          - "-c"
+        args:
+          - |
+            echo "waiting 30s for istio side cars to be up"; sleep 30s;
+            /app/ready.py --service-mesh-check sdnc-sdnrdb-init-job -t 45;
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+      {{- end }}
       {{- if .Values.nodeSelector }}
       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
       {{- end -}}