[MARIADB][COMMON] Add support for mariadb-operator

Add template functions for the mariadb-operator resources
and update the mariadb-galera chart to support them
Change the flag to "useOperator" in cassandra to the global setup
and additional labels for cassandra resources
Changed Policy DB users to support the new mariadb User
and fixed db.sh script to wait for the DB user creation
Use the new readiness image 5.0.1 with the "app-name" option
Change the MariaDB-Galera Service to the "primary" to avoid Deadlocks
Fix previous SDNC patch (https://gerrit.onap.org/r/c/oom/+/135308) and
temporary disable MariaDB for SDNR, as it is not compatible to
MariaDB 11

Issue-ID: OOM-3236

Change-Id: Ie63fcc9c6d5fa802d38c592b449e7ff8553c2ab9
Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
diff --git a/kubernetes/so/components/so-admin-cockpit/values.yaml b/kubernetes/so/components/so-admin-cockpit/values.yaml
index 5e81fa6..32074d9 100644
--- a/kubernetes/so/components/so-admin-cockpit/values.yaml
+++ b/kubernetes/so/components/so-admin-cockpit/values.yaml
@@ -31,7 +31,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 #################################################################
diff --git a/kubernetes/so/components/so-bpmn-infra/values.yaml b/kubernetes/so/components/so-bpmn-infra/values.yaml
index 31573af..0d5a0c4 100755
--- a/kubernetes/so/components/so-bpmn-infra/values.yaml
+++ b/kubernetes/so/components/so-bpmn-infra/values.yaml
@@ -23,7 +23,7 @@
   sdncOamService: sdnc-oam
   sdncOamPort: 8282
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-catalog-db-adapter/values.yaml b/kubernetes/so/components/so-catalog-db-adapter/values.yaml
index c9410ca..23a3b69 100755
--- a/kubernetes/so/components/so-catalog-db-adapter/values.yaml
+++ b/kubernetes/so/components/so-catalog-db-adapter/values.yaml
@@ -22,7 +22,7 @@
   app:
     msoKey: 07a7159d3bf51a0e53be7a8f89699be7
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-cnfm-lcm/values.yaml b/kubernetes/so/components/so-cnfm-lcm/values.yaml
index 4e6adc4..c3388d6 100644
--- a/kubernetes/so/components/so-cnfm-lcm/values.yaml
+++ b/kubernetes/so/components/so-cnfm-lcm/values.yaml
@@ -19,7 +19,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 #################################################################
diff --git a/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml b/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml
index 5d3807e..32171ba 100644
--- a/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml
+++ b/kubernetes/so/components/so-etsi-nfvo-ns-lcm/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 #################################################################
diff --git a/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml b/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml
index ccdb58c..e2816b0 100755
--- a/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml
+++ b/kubernetes/so/components/so-etsi-sol005-adapter/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-mariadb/values.yaml b/kubernetes/so/components/so-mariadb/values.yaml
index bf546a2..8533681 100755
--- a/kubernetes/so/components/so-mariadb/values.yaml
+++ b/kubernetes/so/components/so-mariadb/values.yaml
@@ -22,11 +22,11 @@
   nodePortPrefix: 302
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
-  readinessImage: onap/oom/readiness:4.1.0
+  readinessImage: onap/oom/readiness:5.0.1
   ubuntuInitRepository: docker.io
   mariadbGalera:
     nameOverride: &mariadbName mariadb-galera
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: "3306"
   migration:
     enabled: false
@@ -37,7 +37,8 @@
 
 readinessCheck:
   wait_for:
-    - *mariadbName
+    apps:
+      - *mariadbName
 
 #################################################################
 # Secrets metaconfig
diff --git a/kubernetes/so/components/so-nssmf-adapter/values.yaml b/kubernetes/so/components/so-nssmf-adapter/values.yaml
index 636e32c..c6a6f35 100755
--- a/kubernetes/so/components/so-nssmf-adapter/values.yaml
+++ b/kubernetes/so/components/so-nssmf-adapter/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-oof-adapter/values.yaml b/kubernetes/so/components/so-oof-adapter/values.yaml
index 7c5ab23..24a171c 100755
--- a/kubernetes/so/components/so-oof-adapter/values.yaml
+++ b/kubernetes/so/components/so-oof-adapter/values.yaml
@@ -21,7 +21,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 # Secrets metaconfig
diff --git a/kubernetes/so/components/so-openstack-adapter/values.yaml b/kubernetes/so/components/so-openstack-adapter/values.yaml
index f4a33cb..3258f8f 100755
--- a/kubernetes/so/components/so-openstack-adapter/values.yaml
+++ b/kubernetes/so/components/so-openstack-adapter/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-request-db-adapter/values.yaml b/kubernetes/so/components/so-request-db-adapter/values.yaml
index db6f59a..0ec56c0 100755
--- a/kubernetes/so/components/so-request-db-adapter/values.yaml
+++ b/kubernetes/so/components/so-request-db-adapter/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 readinessCheck:
diff --git a/kubernetes/so/components/so-sdc-controller/values.yaml b/kubernetes/so/components/so-sdc-controller/values.yaml
index 681ff72..eea19df 100755
--- a/kubernetes/so/components/so-sdc-controller/values.yaml
+++ b/kubernetes/so/components/so-sdc-controller/values.yaml
@@ -20,7 +20,7 @@
   persistence:
     mountPath: /dockerdata-nfs
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
   soSdcListenerKafkaUser: so-sdc-list-user
 
diff --git a/kubernetes/so/components/so-sdnc-adapter/values.yaml b/kubernetes/so/components/so-sdnc-adapter/values.yaml
index d05213c..1f0a18d 100755
--- a/kubernetes/so/components/so-sdnc-adapter/values.yaml
+++ b/kubernetes/so/components/so-sdnc-adapter/values.yaml
@@ -23,7 +23,7 @@
   sdncOamService: sdnc-oam
   sdncOamPort: 8282
   mariadbGalera:
-    serviceName: mariadb-galera
+    service: mariadb-galera-primary
     servicePort: '3306'
 
 #################################################################
diff --git a/kubernetes/so/values.yaml b/kubernetes/so/values.yaml
index f2db958..bf412e8 100755
--- a/kubernetes/so/values.yaml
+++ b/kubernetes/so/values.yaml
@@ -22,9 +22,8 @@
   centralizedLoggingEnabled: true
   mariadbGalera:
     nameOverride: mariadb-galera
-    serviceName: mariadb-galera
     servicePort: '3306'
-    service: mariadb-galera
+    service: mariadb-galera-primary
     internalPort: '3306'
     # mariadbRootPassword: secretpassword
     # rootPasswordExternalSecret: some secret
@@ -584,6 +583,9 @@
     externalSecret: *dbRootPassSecretName
   nameOverride: &so-mariadb so-mariadb-galera
   replicaCount: 1
+  mariadbOperator:
+    galera:
+      enabled: false
   persistence:
     mountSubPath: so/mariadb-galera/data
     enabled: true