Merge "[DCAEGEN2] Update Helm Chart for London Release"
diff --git a/kubernetes/common/network-name-gen/Chart.yaml b/kubernetes/common/network-name-gen/Chart.yaml
index 17eaa68..08d5014 100644
--- a/kubernetes/common/network-name-gen/Chart.yaml
+++ b/kubernetes/common/network-name-gen/Chart.yaml
@@ -33,4 +33,4 @@
   - name: mariadb-init

     version: ~12.x-0

     repository: 'file://../mariadb-init'

-    condition: not global.mariadbGalera.localCluster
\ No newline at end of file
+    condition: global.mariadbGalera.globalCluster
\ No newline at end of file
diff --git a/kubernetes/common/network-name-gen/values.yaml b/kubernetes/common/network-name-gen/values.yaml
index dcf85fe..8b8848b 100644
--- a/kubernetes/common/network-name-gen/values.yaml
+++ b/kubernetes/common/network-name-gen/values.yaml
@@ -26,7 +26,10 @@
 
   mariadbGalera: &mariadbGalera
     #This flag allows SO to instantiate its own mariadb-galera cluster
+    #When changing it to "true", also set "globalCluster: false"
+    #as the dependency check will not work otherwise (Chart.yaml)
     localCluster: false
+    globalCluster: true
     service: mariadb-galera
     internalPort: 3306
     nameOverride: mariadb-galera
diff --git a/kubernetes/contrib/components/ejbca/Chart.yaml b/kubernetes/contrib/components/ejbca/Chart.yaml
index e8a0134..5c7ec25 100644
--- a/kubernetes/contrib/components/ejbca/Chart.yaml
+++ b/kubernetes/contrib/components/ejbca/Chart.yaml
@@ -30,7 +30,7 @@
   - name: mariadb-init
     version: ~12.x-0
     repository: '@local'
-    condition: not global.mariadbGalera.localCluster
+    condition: global.mariadbGalera.globalCluster
   - name: repositoryGenerator
     version: ~12.x-0
     repository: '@local'
diff --git a/kubernetes/contrib/components/ejbca/values.yaml b/kubernetes/contrib/components/ejbca/values.yaml
index b777a7d..c223f41 100644
--- a/kubernetes/contrib/components/ejbca/values.yaml
+++ b/kubernetes/contrib/components/ejbca/values.yaml
@@ -13,8 +13,11 @@
 # limitations under the License.
 global:
   mariadbGalera: &mariadbGalera
-    #This flag allows EJBCA to instantiate its own mariadb-galera cluster
+    #This flag allows SO to instantiate its own mariadb-galera cluster
+    #When changing it to "true", also set "globalCluster: false"
+    #as the dependency check will not work otherwise (Chart.yaml)
     localCluster: false
+    globalCluster: true
     service: mariadb-galera
     internalPort: 3306
     nameOverride: mariadb-galera
diff --git a/kubernetes/holmes/Chart.yaml b/kubernetes/holmes/Chart.yaml
index 971d81c..8f8e91d 100644
--- a/kubernetes/holmes/Chart.yaml
+++ b/kubernetes/holmes/Chart.yaml
@@ -34,7 +34,7 @@
   - name: postgres-init
     version: ~12.x-0
     repository: '@local'
-    condition: not global.postgres.localCluster
+    condition: global.postgres.globalCluster
   - name: holmes-rule-mgmt
     version: ~12.x-0
     repository: 'file://components/holmes-rule-mgmt'
diff --git a/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml b/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml
index cdf5327..fdbca09 100644
--- a/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml
+++ b/kubernetes/holmes/components/holmes-engine-mgmt/templates/deployment.yaml
@@ -34,8 +34,10 @@
     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       initContainers:
-      {{- if not .Values.global.postgres.localCluster }}
-      {{ include "common.readinessCheck.waitFor" . | indent 6 | trim }}
+      {{- if .Values.global.postgres.localCluster }}
+      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
+      {{ else }}
+      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
       {{- end }}
       - name: {{ include "common.name" . }}-env-config
         image: {{ include "repositoryGenerator.image.envsubst" . }}
diff --git a/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml b/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml
index c9c62e7..028ca8d 100644
--- a/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml
+++ b/kubernetes/holmes/components/holmes-engine-mgmt/values.yaml
@@ -123,9 +123,11 @@
   unlimited: {}
 
 readinessCheck:
-  wait_for:
+  wait_for_global:
     jobs:
       - '{{ include "common.release" . }}-holmes-postgres-init-config-job'
+  wait_for_local:
+    - '{{ .Values.global.postgres.container.name }}'
 
 #Pods Service Account
 serviceAccount:
diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml b/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml
index 05def92..db0eb16 100644
--- a/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml
+++ b/kubernetes/holmes/components/holmes-rule-mgmt/templates/deployment.yaml
@@ -33,8 +33,10 @@
     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       initContainers:
-      {{- if not .Values.global.postgres.localCluster }}
-      {{ include "common.readinessCheck.waitFor" . | indent 6 | trim }}
+      {{- if .Values.global.postgres.localCluster }}
+      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
+      {{ else }}
+      {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
       {{- end }}
       - name: {{ include "common.name" . }}-env-config
         image: {{ include "repositoryGenerator.image.envsubst" . }}
diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml b/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml
index bc6639f..543b7aa 100644
--- a/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml
+++ b/kubernetes/holmes/components/holmes-rule-mgmt/values.yaml
@@ -135,9 +135,11 @@
   unlimited: {}
 
 readinessCheck:
-  wait_for:
+  wait_for_global:
     jobs:
       - '{{ include "common.release" . }}-holmes-postgres-init-config-job'
+  wait_for_local:
+    - '{{ .Values.global.postgres.container.name }}'
 
 #Pods Service Account
 serviceAccount:
diff --git a/kubernetes/holmes/values.yaml b/kubernetes/holmes/values.yaml
index e8eb53d..40c3d87 100644
--- a/kubernetes/holmes/values.yaml
+++ b/kubernetes/holmes/values.yaml
@@ -22,7 +22,11 @@
   #Service Names of the postgres db to connect to.
   #Override it to dbc-pg if localCluster is enabled.
   postgres:
+    #This flag allows SO to instantiate its own mariadb-galera cluster
+    #When changing it to "true", also set "globalCluster: false"
+    #as the dependency check will not work otherwise (Chart.yaml)
     localCluster: false
+    globalCluster: true
     service:
       name: pgset
       name2: &postgres tcp-pgset-primary
diff --git a/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml b/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml
index a90c700..b1f6c41 100644
--- a/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml
+++ b/kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml
@@ -30,7 +30,7 @@
   - name: mariadb-init
     version: ~12.x-0
     repository: '@local'
-    condition: not global.mariadbGalera.localCluster
+    condition: global.mariadbGalera.globalCluster
   - name: readinessCheck
     version: ~12.x-0
     repository: '@local'
diff --git a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml
index dd9c020..bfbff21 100644
--- a/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml
+++ b/kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml
@@ -41,8 +41,13 @@
       - command:
         - /app/ready.py
         args:
-        - -j
-        - "{{ include "common.release" . }}-{{ include "common.name" . }}-config-job"
+{{- if .Values.global.mariadbGalera.localCluster }}
+        - --container-name
+        - {{ index .Values "mariadb-galera" "nameOverride" }}
+{{- else }}
+        - --job-name
+        - {{ include "common.release" . }}-{{ include "common.name" . }}-config-job
+{{- end }}
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml
index 21abce3..c2b0dcf 100644
--- a/kubernetes/modeling/components/modeling-etsicatalog/values.yaml
+++ b/kubernetes/modeling/components/modeling-etsicatalog/values.yaml
@@ -22,8 +22,11 @@
     mountPath: /dockerdata-nfs
 
   mariadbGalera:
-    #This flag allows Modeling to instantiate its own mariadb-galera cluster
+    #This flag allows SO to instantiate its own mariadb-galera cluster
+    #When changing it to "true", also set "globalCluster: false"
+    #as the dependency check will not work otherwise (Chart.yaml)
     localCluster: false
+    globalCluster: true
     service: mariadb-galera
     internalPort: 3306
     nameOverride: mariadb-galera
diff --git a/kubernetes/nbi/Chart.yaml b/kubernetes/nbi/Chart.yaml
index 5f27787..5365075 100644
--- a/kubernetes/nbi/Chart.yaml
+++ b/kubernetes/nbi/Chart.yaml
@@ -36,7 +36,7 @@
   - name: mariadb-init
     version: ~12.x-0
     repository: '@local'
-    condition: not global.mariadbGalera.localCluster
+    condition: global.mariadbGalera.globalCluster
   - name: repositoryGenerator
     version: ~12.x-0
     repository: '@local'
diff --git a/kubernetes/nbi/values.yaml b/kubernetes/nbi/values.yaml
index e2b7341..fbdf1fe 100644
--- a/kubernetes/nbi/values.yaml
+++ b/kubernetes/nbi/values.yaml
@@ -20,7 +20,10 @@
   nodePortPrefix: 302
   mariadbGalera: &mariadbGalera
     #This flag allows SO to instantiate its own mariadb-galera cluster
+    #When changing it to "true", also set "globalCluster: false"
+    #as the dependency check will not work otherwise (Chart.yaml)
     localCluster: false
+    globalCluster: true
     service: mariadb-galera
     internalPort: 3306
     nameOverride: mariadb-galera