[OOF] Use the common mariadb-galera instance

Updates for OOF CMSO:
- Add section under (.Values.global) for shared mariadb instance with a
condition to instantiate local instance.
- Use a hook to send mariadb info to oof-csmo-service and
oof-csmo-optimizer
- Add condition under (requirments.yaml) to install local mariadb
instance
- Update oof-cmso-service and oof-cmso-optimizer (.Values) files to
accomodate for local mariadb instance
- Update oof-cmso-service and oof-cmso-optimizer deployments to use the
templates defined under (templates/_mariadb.tpl)

Issue-ID: OOM-2769
Signed-off-by: Mahmoud Abdelhamid <mahmoud.abdelhamid@orange.com>
Change-Id: I59e6c98ae992faafd363c5f97e18bf631f9c4d4e
diff --git a/kubernetes/oof/components/oof-cmso/values.yaml b/kubernetes/oof/components/oof-cmso/values.yaml
index c46fd0a..15aac51 100644
--- a/kubernetes/oof/components/oof-cmso/values.yaml
+++ b/kubernetes/oof/components/oof-cmso/values.yaml
@@ -13,6 +13,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+global:
+  commonConfigPrefix: "oof-cmso"
+  truststoreFile: "truststoreONAPall.jks"
+  keystoreFile: "org.onap.oof.jks"
+  truststorePassword:
+  authentication: aaf-auth
+  mariadbGalera: &mariadbGalera
+    #This flag allows OOF-CMSO to instantiate its own mariadb-galera cluster
+    localCluster: false
+    service: mariadb-galera
+    internalPort: 3306
+    nameOverride: mariadb-galera
+
 #################################################################
 # Secrets metaconfig
 #################################################################
@@ -42,7 +55,7 @@
     login: '{{ .Values.config.aaf.user }}'
     password: '{{ .Values.config.aaf.password }}'
 
-mariadb-galera:
+mariadb-galera: &localMariadb
   replicaCount: 1
   nameOverride: &dbName cmso-db
   nfsprovisionerPrefix: cmso
@@ -56,19 +69,7 @@
   serviceAccount:
     nameOverride: *dbName
 
-global:
-  commonConfigPrefix: "oof-cmso"
-  truststoreFile: "truststoreONAPall.jks"
-  keystoreFile: "org.onap.oof.jks"
-  truststorePassword:
-  authentication: aaf-auth
-
 mariadb-init:
-  mariadbGalera:
-    containerName: *dbName
-    serviceName: *dbName
-    servicePort: 3306
-    userRootSecret: *rootPassword
   config:
     userCredentialsExternalSecret: *serviceDbCreds
     mysqlDatabase: cmso
@@ -117,11 +118,10 @@
   certInitializer:
     << : *certInitConfig
     nameOverride: oof-cmso-service-cert-initializer
+  mariadb-galera: *localMariadb
   config:
     db:
       userCredentialsExternalSecret: *serviceDbCreds
-      host: *dbName
-      container: *dbName
       mysqlDatabase: cmso
     aaf:
       userCredentialsExternalSecret: *aafCreds
@@ -131,12 +131,11 @@
   certInitializer:
     << : *certInitConfig
     nameOverride: oof-cmso-optimizer-cert-initializer
+  mariadb-galera: *localMariadb
   config:
     enabled: true
     db:
       userCredentialsExternalSecret: *optimizerDbCreds
-      host: *dbName
-      container: *dbName
       mysqlDatabase: optimizer
     aaf:
       userCredentialsExternalSecret: *aafCreds