[COMMON] Update all ReadinessChecks

Use the new "service" feature of the readiness image to
resolve startup dependencies.

Issue-ID: OOM-3280

Change-Id: Ia331d51528676744e5e0479d1fd0ca02830c3499
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
diff --git a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
index d8f1afd..d1e0ebf 100644
--- a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
@@ -50,11 +50,11 @@
       - command:
         - /app/ready.py
         args:
-        - --app-name
-        - {{ include "common.mariadbAppName" . }}
-        - --container-name
+        - --service-name
+        - {{ include "common.mariadbService" . }}
+        - --service-name
         - {{ .Values.config.sdncChartName }}
-        - --container-name
+        - --service-name
         - {{ .Values.config.msgRouterContainerName }}
         env:
         - name: NAMESPACE
diff --git a/kubernetes/sdnc/components/network-name-gen/templates/deployment.yaml b/kubernetes/sdnc/components/network-name-gen/templates/deployment.yaml
index fbb8044..e1fcd23 100644
--- a/kubernetes/sdnc/components/network-name-gen/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/network-name-gen/templates/deployment.yaml
@@ -29,8 +29,8 @@
         - /app/ready.py
         args:
 {{- if .Values.global.mariadbGalera.localCluster }}
-        - --app-name
-        - {{ index .Values "mariadb-galera" "nameOverride" }}
+        - --service-name
+        - {{ include "common.mariadbService" . }}
 {{- else }}
         - --job-name
         - {{ include "common.release" . }}-{{ index .Values "mariadb-init" "nameOverride" }}-config-job
diff --git a/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
index 731a66d..d39a682 100644
--- a/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
@@ -50,7 +50,7 @@
       - command:
         - /app/ready.py
         args:
-        - --container-name
+        - --service-name
         - {{ .Values.config.sdncChartName }}
         env:
         - name: NAMESPACE
diff --git a/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
index 66eb307..851c19f 100644
--- a/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
@@ -27,9 +27,9 @@
       - command:
         - /app/ready.py
         args:
-        - --container-name
+        - --service-name
         - sdnc
-        - --container-name
+        - --service-name
         - consul
         env:
         - name: NAMESPACE
diff --git a/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
index cdbe90e..b9d7a1b 100644
--- a/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
@@ -30,7 +30,7 @@
         command:
         - /app/ready.py
         args:
-        - --container-name
+        - --service-name
         - {{ .Values.config.sdncChartName }}
         env:
         - name: NAMESPACE
diff --git a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
index 579e076..d5d496f 100644
--- a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
@@ -53,13 +53,13 @@
       - command:
         - /app/ready.py
         args:
-        - --app-name
-        - {{ include "common.mariadbAppName" . }}
-        - --container-name
+        - --service-name
+        - {{ include "common.mariadbService" . }}
+        - --service-name
         - {{ .Values.config.sdncChartName }}
-        - --container-name
+        - --service-name
         - {{ .Values.config.sdcbeChartName }}
-        - --container-name
+        - --service-name
         - {{ .Values.config.msgRouterContainerName }}
         env:
         - name: NAMESPACE
diff --git a/kubernetes/sdnc/templates/job.yaml b/kubernetes/sdnc/templates/job.yaml
index 5aaae2a..3dcfdea 100755
--- a/kubernetes/sdnc/templates/job.yaml
+++ b/kubernetes/sdnc/templates/job.yaml
@@ -34,7 +34,7 @@
         release: {{ include "common.release" . }}
       name: {{ include "common.name" . }}
     spec:
-      initContainers:
+      initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
       - command:
         - sh
         args:
@@ -75,20 +75,6 @@
         image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
-
-      {{- if .Values.global.mariadbGalera.localCluster }}
-      {{-   if .Values.global.mariadbGalera.useOperator }}
-      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local_operator ) | indent 6 | trim }}
-      {{    else }}
-      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
-      {{-   end }}
-      {{ else }}
-      {{-   if .Values.global.mariadbGalera.useOperator }}
-      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global_operator ) | indent 6 | trim }}
-      {{   else }}
-      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
-      {{-   end }}
-      {{- end }}
       containers:
       - name: {{ include "common.name" . }}
         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
diff --git a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
index 2c31411..419a9c4 100755
--- a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
+++ b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
@@ -28,8 +28,8 @@
         - /app/ready.py
         args:
         {{- if .Values.config.sdnr.mariadb.enabled }}
-        - --app-name
-        - {{ include "common.mariadbAppName" . }}
+        - --service-name
+        - {{ include "common.mariadbService" . }}
         {{- else }}
         - --container-name
         - {{.Values.elasticsearch.nameOverride}}-elasticsearch
diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml
index 86a011b..4b78230 100644
--- a/kubernetes/sdnc/templates/statefulset.yaml
+++ b/kubernetes/sdnc/templates/statefulset.yaml
@@ -138,8 +138,8 @@
         - /app/ready.py
         args:
         {{ if .Values.dgbuilder.enabled -}}
-        - --app-name
-        - {{ include "common.mariadbAppName" . }}
+        - --service-name
+        - {{ include "common.mariadbService" . }}
         - --job-name
         - {{ include "common.fullname" . }}-dbinit-job
         {{ end -}}
diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml
index e6a12ab..dc5fe74 100644
--- a/kubernetes/sdnc/values.yaml
+++ b/kubernetes/sdnc/values.yaml
@@ -693,15 +693,6 @@
   path: /var/log/onap
 
 readinessCheck:
-  wait_for_global_operator:
-    pods:
-      - '{{ .Values.global.mariadbGalera.nameOverride }}-0'
-  wait_for_local_operator:
-    pods:
-      - '{{ index .Values "mariadb-galera" "nameOverride" }}-0'
-  wait_for_global:
-    apps:
-      - '{{ include "common.mariadbAppName" . }}'
-  wait_for_local:
-    apps:
-      - '{{ include "common.mariadbAppName" . }}'
+  wait_for:
+    services:
+      - '{{ include "common.mariadbService" . }}'