SO Rolling upgrade using helm hooks

Issue-ID: OOM-1772

Change-Id: If206ae7cc2f4273889376e1bb3fa77bacfaae3cc
Signed-off-by: Mahendra Raghuwanshi <mahendra.raghuwanshi@amdocs.com>
diff --git a/kubernetes/so/charts/so-bpmn-infra/templates/deployment.yaml b/kubernetes/so/charts/so-bpmn-infra/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-bpmn-infra/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-bpmn-infra/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-bpmn-infra/values.yaml b/kubernetes/so/charts/so-bpmn-infra/values.yaml
index 2deb907..55fad1c 100755
--- a/kubernetes/so/charts/so-bpmn-infra/values.yaml
+++ b/kubernetes/so/charts/so-bpmn-infra/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -71,8 +71,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 nodeSelector: {}
diff --git a/kubernetes/so/charts/so-catalog-db-adapter/templates/deployment.yaml b/kubernetes/so/charts/so-catalog-db-adapter/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-catalog-db-adapter/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-catalog-db-adapter/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-catalog-db-adapter/values.yaml b/kubernetes/so/charts/so-catalog-db-adapter/values.yaml
index beeaf72..438fd2d 100755
--- a/kubernetes/so/charts/so-catalog-db-adapter/values.yaml
+++ b/kubernetes/so/charts/so-catalog-db-adapter/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -72,8 +72,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 config:
diff --git a/kubernetes/so/charts/so-db-secrets/templates/secrets.yaml b/kubernetes/so/charts/so-db-secrets/templates/secrets.yaml
index f53c67f..d19803c 100755
--- a/kubernetes/so/charts/so-db-secrets/templates/secrets.yaml
+++ b/kubernetes/so/charts/so-db-secrets/templates/secrets.yaml
@@ -22,8 +22,8 @@
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 data:
-  mariadb.readwrite.host : {{ .Values.db_host | b64enc | quote }}
-  mariadb.readwrite.port : {{ .Values.db_port | b64enc | quote }}
+  mariadb.readwrite.host : {{ .Values.global.mariadbGalera.serviceName | b64enc | quote }}
+  mariadb.readwrite.port : {{ .Values.global.mariadbGalera.servicePort | b64enc | quote }}
   mariadb.readwrite.rolename: {{ .Values.db_username | b64enc | quote }}
   mariadb.readwrite.password: {{ .Values.db_password | b64enc | quote }}
   mariadb.admin.rolename: {{ .Values.db_admin_username| b64enc | quote }}
diff --git a/kubernetes/so/charts/so-db-secrets/values.yaml b/kubernetes/so/charts/so-db-secrets/values.yaml
index 8836802..63b6852 100644
--- a/kubernetes/so/charts/so-db-secrets/values.yaml
+++ b/kubernetes/so/charts/so-db-secrets/values.yaml
@@ -11,8 +11,6 @@
 # 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.
-db_host: so-mariadb
-db_port: "3306"
 db_admin_username: so_admin
 db_admin_password: so_Admin123
 db_username: so_user
diff --git a/kubernetes/so/charts/so-mariadb/resources/config/mariadb/conf.d/mariadb1.cnf b/kubernetes/so/charts/so-mariadb/resources/config/mariadb/conf.d/mariadb1.cnf
deleted file mode 100755
index 39ed022..0000000
--- a/kubernetes/so/charts/so-mariadb/resources/config/mariadb/conf.d/mariadb1.cnf
+++ /dev/null
@@ -1,193 +0,0 @@
-# Example MySQL config file for medium systems.
-#
-# This is for a system with memory 8G where MySQL plays
-# an important part, or systems up to 128M where MySQL is used together with
-# other programs (such as a web server)
-#
-# In this file, you can use all long options that a program supports.
-# If you want to know which options a program supports, run the program
-# with the "--help" option.
-
-# The following options will be passed to all MySQL clients
-##[client]
-##user            = root
-##port            = 3306
-##socket          = //opt/app/mysql/mysql.sock
-
-# Here follows entries for some specific programs
-
-# The MySQL server
-[mysqld]
-##performance_schema
-
-slow_query_log =ON
-long_query_time =2
-slow_query_log_file =//var/lib/mysql/slow_query.log
-
-skip-external-locking
-explicit_defaults_for_timestamp = true
-skip-symbolic-links
-local-infile = 0
-key_buffer_size = 16M
-max_allowed_packet = 4M
-table_open_cache = 100
-sort_buffer_size = 512K
-net_buffer_length = 8K
-read_buffer_size = 256K
-read_rnd_buffer_size = 512K
-myisam_sort_buffer_size = 8M
-max_connections = 500
-lower_case_table_names = 1
-thread_stack = 256K
-thread_cache_size = 25
-query_cache_size = 8M
-query_cache_type = 0
-query_prealloc_size = 512K
-query_cache_limit = 1M
-
-# Password validation
-##plugin-load-add=simple_password_check.so
-##simple_password_check_other_characters=0
-
-# Audit Log settings
-plugin-load-add=server_audit.so
-server_audit=FORCE_PLUS_PERMANENT
-server_audit_file_path=//var/lib/mysql/audit.log
-server_audit_file_rotate_size=50M
-server_audit_events=CONNECT,QUERY,TABLE
-server_audit_logging=on
-
-# Don't listen on a TCP/IP port at all. This can be a security enhancement,
-# if all processes that need to connect to mysqld run on the same host.
-# All interaction with mysqld must be made via Unix sockets or named pipes.
-# Note that using this option without enabling named pipes on Windows
-# (via the "enable-named-pipe" option) will render mysqld useless!
-#
-#skip-networking
-
-# Replication Master Server (default)
-# binary logging is required for replication
-##log-bin=//var/lib/mysql/mysql-bin
-
-# binary logging format - mixed recommended
-binlog_format=row
-
-# required unique id between 1 and 2^32 - 1
-# defaults to 1 if master-host is not set
-# but will not function as a master if omitted
-
-# Replication Slave (comment out master section to use this)
-#
-# To configure this host as a replication slave, you can choose between
-# two methods :
-#
-# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
-#    the syntax is:
-#
-#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
-#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
-#
-#    where you replace <host>, <user>, <password> by quoted strings and
-#    <port> by the master's port number (3306 by default).
-#
-#    Example:
-#
-#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
-#    MASTER_USER='joe', MASTER_PASSWORD='secret';
-#
-# OR
-#
-# 2) Set the variables below. However, in case you choose this method, then
-#    start replication for the first time (even unsuccessfully, for example
-#    if you mistyped the password in master-password and the slave fails to
-#    connect), the slave will create a master.info file, and any later
-#    change in this file to the variables' values below will be ignored and
-#    overridden by the content of the master.info file, unless you shutdown
-#    the slave server, delete master.info and restart the slaver server.
-#    For that reason, you may want to leave the lines below untouched
-#    (commented) and instead use CHANGE MASTER TO (see above)
-#
-# required unique id between 2 and 2^32 - 1
-# (and different from the master)
-# defaults to 2 if master-host is set
-# but will not function as a slave if omitted
-#server-id       = 2
-#
-# The replication master for this slave - required
-#master-host     =   <hostname>
-#
-# The username the slave will use for authentication when connecting
-# to the master - required
-#master-user     =   <username>
-#
-# The password the slave will authenticate with when connecting to
-# the master - required
-#master-password =   <password>
-#
-# The port the master is listening on.
-# optional - defaults to 3306
-#master-port     =  <port>
-#
-# binary logging - not required for slaves, but recommended
-#log-bin=mysql-bin
-
-# Uncomment the following if you are using InnoDB tables
-##innodb_data_home_dir = //opt/app/mysql/data
-##innodb_data_file_path = ibdata1:20M:autoextend:max:32G
-##innodb_log_group_home_dir = //opt/app/mysql/iblogs
-# You can set .._buffer_pool_size up to 50 - 80 %
-# of RAM but beware of setting memory usage too high
-#innodb_buffer_pool_size = 6380M
-#innodb_additional_mem_pool_size = 2M
-# Set .._log_file_size to 25 % of buffer pool size
-innodb_log_file_size = 150M
-innodb_log_files_in_group = 3
-innodb_log_buffer_size = 8M
-#innodb_flush_log_at_trx_commit = 1
-innodb_lock_wait_timeout = 50
-innodb_autoextend_increment = 100
-expire_logs_days = 8
-open_files_limit = 2000
-transaction-isolation=READ-COMMITTED
-####### Galera parameters #######
-## Galera Provider configuration
-wsrep_provider=/usr/lib/galera/libgalera_smm.so
-wsrep_provider_options="gcache.size=2G; gcache.page_size=1G"
-## Galera Cluster configuration
-wsrep_cluster_name="MSO-automated-tests-cluster"
-wsrep_cluster_address="gcomm://"
-#wsrep_cluster_address="gcomm://mariadb1,mariadb2,mariadb3"
-##wsrep_cluster_address="gcomm://192.169.3.184,192.169.3.185,192.169.3.186"
-## Galera Synchronization configuration
-wsrep_sst_method=rsync
-#wsrep_sst_method=xtrabackup-v2
-#wsrep_sst_auth="sstuser:Mon#2o!6"
-## Galera Node configuration
-wsrep_node_name="mariadb1"
-##wsrep_node_address="192.169.3.184"
-wsrep_on=ON
-## Status notification
-#wsrep_notify_cmd=/opt/app/mysql/bin/wsrep_notify
-#######
-
-
-[mysqldump]
-quick
-max_allowed_packet = 16M
-
-[mysql]
-no-auto-rehash
-# Remove the next comment character if you are not familiar with SQL
-#safe-updates
-
-[myisamchk]
-key_buffer_size = 20971520
-
-##[mysqlhotcopy]
-##interactive-timeout
-##[mysqld_safe]
-##malloc-lib=//opt/app/mysql/local/lib/libjemalloc.so.1
-##log-error=//opt/app/mysql/log/mysqld.log
-
-general_log_file        = /var/log/mysql/mysql.log
-general_log             = 1
diff --git a/kubernetes/so/charts/so-mariadb/templates/NOTES.txt b/kubernetes/so/charts/so-mariadb/templates/NOTES.txt
deleted file mode 100755
index c60c745..0000000
--- a/kubernetes/so/charts/so-mariadb/templates/NOTES.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range .Values.ingress.hosts }}
-  http://{{ . }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
-  export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }})
-  export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
-  echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.type }}
-     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
-           You can watch the status of by running 'kubectl get svc -w {{ include "common.name" . }}'
-  export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
-  echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
-{{- else if contains "ClusterIP" .Values.service.type }}
-  export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ include "common.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
-  echo "Visit http://127.0.0.1:8080 to use your application"
-  kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
-{{- end }}
diff --git a/kubernetes/so/charts/so-mariadb/templates/configmap.yaml b/kubernetes/so/charts/so-mariadb/templates/configmap.yaml
deleted file mode 100755
index a470bb2..0000000
--- a/kubernetes/so/charts/so-mariadb/templates/configmap.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# 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.
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: confd-configmap
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-data:
-{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }}
\ No newline at end of file
diff --git a/kubernetes/so/charts/so-mariadb/templates/deployment.yaml b/kubernetes/so/charts/so-mariadb/templates/deployment.yaml
deleted file mode 100755
index 6c7b85f..0000000
--- a/kubernetes/so/charts/so-mariadb/templates/deployment.yaml
+++ /dev/null
@@ -1,110 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# 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.
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  replicas: {{ .Values.replicaCount }}
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
-    spec:
-      hostname: mariadb
-      initContainers:
-      - name: {{ include "common.name" . }}-inject-testlab-project
-        command:
-        - /bin/bash
-        - -c
-        - >
-          git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
-          echo "Clone complete. Copying from /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d to /docker-entrypoint-initdb.d";
-          cp -rf /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d;
-          chmod -R 755 /docker-entrypoint-initdb.d;
-          echo "Done.";
-        image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts:
-        - name: docker-entrypoint-initdb-d
-          mountPath: "/docker-entrypoint-initdb.d"
-      containers:
-      - name: {{ include "common.name" . }}
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        ports:
-        - containerPort: {{ .Values.service.internalPort }}
-        {{ if eq .Values.liveness.enabled true }}
-        livenessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
-          initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.liveness.periodSeconds }}
-        {{ end }}
-        readinessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
-          initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
-          periodSeconds: {{ .Values.readiness.periodSeconds }}
-        env:
-          - name: MYSQL_ROOT_PASSWORD
-            valueFrom:
-              secretKeyRef:
-                name: {{ template "common.fullname" . }}
-                key: db-root-password
-        volumeMounts:
-        - mountPath: /var/lib/mysql
-          name: mariadb-data
-        - mountPath: /etc/localtime
-          name: localtime
-          readOnly: true
-        - mountPath: /etc/mysql/conf.d
-          name: mariadb-conf
-        - name: docker-entrypoint-initdb-d
-          mountPath: "/docker-entrypoint-initdb.d"
-        resources:
-{{ include "common.resources" . | indent 12 }}
-      {{- if .Values.nodeSelector }}
-      nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-      {{- end -}}
-      {{- if .Values.affinity }}
-      affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-      {{- end }}
-      volumes:
-      - name: mariadb-data
-      {{- if .Values.persistence.enabled }}
-        persistentVolumeClaim:
-          claimName: {{ include "common.fullname" . }}
-      {{- else }}
-        emptyDir: {}
-      {{- end }}
-      - name: mariadb-conf
-        configMap:
-          name: confd-configmap
-      - name: localtime
-        hostPath:
-          path: /etc/localtime
-      - name: docker-entrypoint-initdb-d
-        emptyDir: {}
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/so/charts/so-mariadb/templates/job.yaml b/kubernetes/so/charts/so-mariadb/templates/job.yaml
new file mode 100755
index 0000000..a20564e
--- /dev/null
+++ b/kubernetes/so/charts/so-mariadb/templates/job.yaml
@@ -0,0 +1,193 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.global.migration.enabled }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ include "common.fullname" . }}-backup
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  annotations:
+    "helm.sh/hook": pre-upgrade,pre-install
+    "helm.sh/hook-weight": "1"
+    "helm.sh/hook-delete-policy": before-hook-creation
+spec:
+  backoffLimit: 20
+  template:
+    metadata:
+      labels:
+        app: {{ include "common.name" . }}
+        release: {{ .Release.Name }}
+      name: {{ include "common.name" . }}
+    spec:
+      containers:
+      - name: {{ include "common.fullname" . }}
+        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        env:
+        - name: DB_HOST
+          value: {{ .Values.global.migration.dbHost }}
+        - name: DB_USER
+          value: {{ .Values.global.migration.dbUser }}
+        - name: DB_PORT
+          value: "{{ .Values.global.migration.dbPort }}"
+        - name: DB_PASS
+          valueFrom:
+            secretKeyRef:
+              name: {{ template "common.fullname" . }}-migration
+              key: db-root-password-backup
+        command:
+        - /bin/bash
+        - -c
+        - mysqldump -vv --user=${DB_USER} --password=${DB_PASS} --host=${DB_HOST} --port=${DB_PORT} --databases --single-transaction --quick --lock-tables=false catalogdb requestdb > /var/data/mariadb/backup-`date +%s`.sql
+        volumeMounts:
+        - mountPath: /etc/localtime
+          name: localtime
+          readOnly: true
+        - name: backup-storage
+          mountPath: /var/data/mariadb
+      volumes:
+      - name: localtime
+        hostPath:
+          path: /etc/localtime
+      - name: backup-storage
+        persistentVolumeClaim:
+          claimName: {{ include "common.fullname" . }}-migration
+      imagePullSecrets:
+        - name: "{{ include "common.namespace" . }}-docker-registry-key"
+      restartPolicy: Never
+---
+{{- end }}
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ include "common.fullname" . }}-config-job
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  annotations:
+    "helm.sh/hook": post-upgrade,post-rollback,post-install
+    "helm.sh/hook-weight": "0"
+    "helm.sh/hook-delete-policy": before-hook-creation
+spec:
+  backoffLimit: 20
+  template:
+    metadata:
+      labels:
+        app: {{ include "common.name" . }}-job
+        release: {{ .Release.Name }}
+      name: {{ include "common.name" . }}
+    spec:
+      initContainers:
+      - name: {{ include "common.name" . }}-readiness
+        command:
+        - /root/ready.py
+        args:
+        - --container-name
+        - {{ .Values.global.mariadbGalera.nameOverride }}
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+      - name: {{ include "common.name" . }}-inject-testlab-project
+        command:
+        - /bin/bash
+        - -c
+        - >
+          git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
+          echo "Clone complete. Copying from /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d to /docker-entrypoint-initdb.d";
+          cp -rf /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d;
+          chmod -R 755 /docker-entrypoint-initdb.d;
+          echo "Done.";
+        image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - name: docker-entrypoint-initdb-d
+          mountPath: "/docker-entrypoint-initdb.d"
+      containers:
+      - name: {{ include "common.name" . }}
+        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        command:
+        - /bin/bash
+        - -c
+        - >
+          mysql() { /usr/bin/mysql  -h ${DB_HOST} -P ${DB_PORT} "$@"; };
+          export -f mysql;
+          mysql --user=root --password=${MYSQL_ROOT_PASSWORD} requestdb -e exit > /dev/null 2>&1 {{ if not .Values.global.migration.enabled }} && echo "Database already initialized!!!" && exit 0 {{ end }};
+          for f in /docker-entrypoint-initdb.d/*; do case "$f" in  *.sh) echo "$0: running $f"; . "$f" ;;  *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;  *) echo "$0: ignoring $f" ;;  esac; echo; done;
+          {{- if .Values.global.migration.enabled }}
+          mysql -vv --user=root --password=${MYSQL_ROOT_PASSWORD} < `ls -tr /var/data/mariadb/* | tail -1`;
+          {{- end }}
+        env:
+        - name: DB_HOST
+          valueFrom:
+            secretKeyRef:
+              name: {{ .Release.Name}}-so-db-secrets
+              key: mariadb.readwrite.host
+        - name: DB_PORT
+          valueFrom:
+            secretKeyRef:
+              name: {{ .Release.Name}}-so-db-secrets
+              key: mariadb.readwrite.port
+        - name: MYSQL_ROOT_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              name: {{ template "common.fullname" . }}
+              key: db-root-password
+        volumeMounts:
+        - mountPath: /etc/localtime
+          name: localtime
+          readOnly: true
+        - name: docker-entrypoint-initdb-d
+          mountPath: "/docker-entrypoint-initdb.d"
+        {{- if .Values.global.migration.enabled }}
+        - name: backup-storage
+          mountPath: /var/data/mariadb
+        {{- end }}
+        resources:
+{{ include "common.resources" . | indent 12 }}
+      {{- if .Values.nodeSelector }}
+      nodeSelector:
+{{ toYaml .Values.nodeSelector | indent 10 }}
+      {{- end -}}
+      {{- if .Values.affinity }}
+      affinity:
+{{ toYaml .Values.affinity | indent 10 }}
+      {{- end }}
+      volumes:
+      - name: localtime
+        hostPath:
+          path: /etc/localtime
+      - name: docker-entrypoint-initdb-d
+        emptyDir: {}
+      {{- if .Values.global.migration.enabled }}
+      - name: backup-storage
+        persistentVolumeClaim:
+          claimName: {{ include "common.fullname" . }}-migration
+      {{- end }}
+      restartPolicy: Never
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/so/charts/so-mariadb/templates/pv.yaml b/kubernetes/so/charts/so-mariadb/templates/pv.yaml
index d1e1b04..5f5d09e 100755
--- a/kubernetes/so/charts/so-mariadb/templates/pv.yaml
+++ b/kubernetes/so/charts/so-mariadb/templates/pv.yaml
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2017 Amdocs, Bell Canada
+# Copyright ▒ 2017 Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,18 +13,23 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 */}}
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+
+{{- if .Values.global.migration.enabled }}
 kind: PersistentVolume
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" . }}
+  name: {{ include "common.fullname" . }}-migration
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
     release: "{{ .Release.Name }}"
     heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
+    name: {{ include "common.fullname" . }}-migration
+  annotations:
+    "helm.sh/hook": pre-upgrade,pre-install
+    "helm.sh/hook-weight": "0"
+    "helm.sh/hook-delete-policy": before-hook-creation
 spec:
   capacity:
     storage: {{ .Values.persistence.size}}
@@ -33,4 +38,4 @@
   persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
   hostPath:
     path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
-{{- end -}}
\ No newline at end of file
+{{- end }}
diff --git a/kubernetes/so/charts/so-mariadb/templates/pvc.yaml b/kubernetes/so/charts/so-mariadb/templates/pvc.yaml
index 74ba690..92d5eed 100755
--- a/kubernetes/so/charts/so-mariadb/templates/pvc.yaml
+++ b/kubernetes/so/charts/so-mariadb/templates/pvc.yaml
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2017 Amdocs, Bell Canada
+# Copyright ▒ 2017 Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,25 +13,29 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 */}}
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+
+{{- if .Values.global.migration.enabled }}
 kind: PersistentVolumeClaim
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" . }}
+  name: {{ include "common.fullname" . }}-migration
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     release: "{{ .Release.Name }}"
     heritage: "{{ .Release.Service }}"
-{{- if .Values.persistence.annotations }}
   annotations:
+    "helm.sh/hook": pre-upgrade,pre-install
+    "helm.sh/hook-weight": "-1"
+    "helm.sh/hook-delete-policy": before-hook-creation
+{{- if .Values.persistence.annotations }}
 {{ toYaml .Values.persistence.annotations | indent 4 }}
 {{- end }}
 spec:
   selector:
     matchLabels:
-      name: {{ include "common.fullname" . }}
+      name: {{ include "common.fullname" . }}-migration
   accessModes:
     - {{ .Values.persistence.accessMode }}
   resources:
@@ -44,4 +48,5 @@
   storageClassName: "{{ .Values.persistence.storageClass }}"
 {{- end }}
 {{- end }}
-{{- end -}}
\ No newline at end of file
+{{- end }}
+
diff --git a/kubernetes/so/charts/so-mariadb/templates/secrets.yaml b/kubernetes/so/charts/so-mariadb/templates/secrets.yaml
index 24f7139..99ccb55 100755
--- a/kubernetes/so/charts/so-mariadb/templates/secrets.yaml
+++ b/kubernetes/so/charts/so-mariadb/templates/secrets.yaml
@@ -23,4 +23,24 @@
     heritage: {{ .Release.Service }}
 type: Opaque
 data:
-  db-root-password: {{ .Values.config.mariadbRootPassword | b64enc | quote }}
\ No newline at end of file
+  db-root-password: {{ .Values.global.mariadbGalera.mariadbRootPassword | b64enc | quote }}
+{{- if .Values.global.migration.enabled }}
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "common.fullname" . }}-migration
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  annotations:
+    "helm.sh/hook": pre-upgrade,pre-install
+    "helm.sh/hook-weight": "0"
+    "helm.sh/hook-delete-policy": before-hook-creation
+type: Opaque
+data:
+  db-root-password-backup: {{ .Values.global.migration.dbPassword | b64enc | quote }}
+{{- end }}
diff --git a/kubernetes/so/charts/so-mariadb/templates/service.yaml b/kubernetes/so/charts/so-mariadb/templates/service.yaml
deleted file mode 100755
index 010dc71..0000000
--- a/kubernetes/so/charts/so-mariadb/templates/service.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# 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.
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  type: {{ .Values.service.type }}
-  ports:
-    - name: {{ .Values.service.portName }}
-    {{ if eq .Values.service.type "NodePort" }}
-      port: {{ .Values.service.internalPort }}
-      nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.nodePort }}
-    {{ else }}
-      port: {{ .Values.service.externalPort }}
-      targetPort: {{ .Values.service.internalPort }}
-    {{ end }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
\ No newline at end of file
diff --git a/kubernetes/so/charts/so-mariadb/values.yaml b/kubernetes/so/charts/so-mariadb/values.yaml
index 950b43a..acf9cb4 100755
--- a/kubernetes/so/charts/so-mariadb/values.yaml
+++ b/kubernetes/so/charts/so-mariadb/values.yaml
@@ -22,10 +22,8 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   ubuntuInitRepository: registry.hub.docker.com
-  persistence:
-    mountPath: /dockerdata-nfs
 
 #################################################################
 # Application configuration defaults.
@@ -38,26 +36,37 @@
 
 # application configuration
 config:
-  mariadbRootPassword: password
   # gerrit branch where the latest heat code is checked in
   gerritBranch: master
   # gerrit project where the latest heat code is checked in
   gerritProject: http://gerrit.onap.org/r/so/docker-config.git
 # default number of instances
-replicaCount: 1
 nodeSelector: {}
 affinity: {}
-# probe configuration parameters
-liveness:
-  initialDelaySeconds: 450
-  periodSeconds: 10
-  # necessary to disable liveness probe when setting breakpoints
-  # in debugger so K8s doesn't restart unresponsive container
-  enabled: true
-readiness:
-  initialDelaySeconds: 450
-  periodSeconds: 10
-## Persist data to a persitent volume
+
+ingress:
+  enabled: false
+
+# Resource Limit flavor
+flavor: small
+
+resources:
+  small:
+    limits:
+      cpu: 2
+      memory: 4Gi
+    requests:
+      cpu: 1
+      memory: 2Gi
+  large:
+    limits:
+      cpu: 4
+      memory: 8Gi
+    requests:
+      cpu: 2
+      memory: 4Gi
+  unlimited: {}
+
 persistence:
   enabled: true
   ## A manually managed Persistent Volume and Claim
@@ -75,31 +84,6 @@
   # storageClass: "-"
   accessMode: ReadWriteMany
   size: 2Gi
+
   mountPath: /dockerdata-nfs
-  mountSubPath: mso/mariadb/data
-service:
-  type: NodePort
-  portName: mariadb
-  internalPort: 3306
-  externalPort: 3306
-  nodePort: 52
-ingress:
-  enabled: false
-# Resource Limit flavor
-flavor: small
-resources:
-  small:
-    limits:
-      cpu: 2
-      memory: 4Gi
-    requests:
-      cpu: 1
-      memory: 2Gi
-  large:
-    limits:
-      cpu: 4
-      memory: 8Gi
-    requests:
-      cpu: 2
-      memory: 4Gi
-  unlimited: {}
+  mountSubPath: so/migration
diff --git a/kubernetes/so/charts/so-monitoring/values.yaml b/kubernetes/so/charts/so-monitoring/values.yaml
index 29cfab1..73ce6ad 100644
--- a/kubernetes/so/charts/so-monitoring/values.yaml
+++ b/kubernetes/so/charts/so-monitoring/values.yaml
@@ -24,7 +24,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
diff --git a/kubernetes/so/charts/so-openstack-adapter/templates/deployment.yaml b/kubernetes/so/charts/so-openstack-adapter/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-openstack-adapter/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-openstack-adapter/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-openstack-adapter/values.yaml b/kubernetes/so/charts/so-openstack-adapter/values.yaml
index f97ad13..93aa5f4 100755
--- a/kubernetes/so/charts/so-openstack-adapter/values.yaml
+++ b/kubernetes/so/charts/so-openstack-adapter/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -72,8 +72,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 config:
diff --git a/kubernetes/so/charts/so-request-db-adapter/templates/deployment.yaml b/kubernetes/so/charts/so-request-db-adapter/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-request-db-adapter/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-request-db-adapter/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-request-db-adapter/values.yaml b/kubernetes/so/charts/so-request-db-adapter/values.yaml
index 16d4a15..1bbc26f 100755
--- a/kubernetes/so/charts/so-request-db-adapter/values.yaml
+++ b/kubernetes/so/charts/so-request-db-adapter/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -72,8 +72,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 nodeSelector: {}
diff --git a/kubernetes/so/charts/so-sdc-controller/templates/deployment.yaml b/kubernetes/so/charts/so-sdc-controller/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-sdc-controller/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-sdc-controller/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-sdc-controller/values.yaml b/kubernetes/so/charts/so-sdc-controller/values.yaml
index 06d8c81..3c1b5e4 100755
--- a/kubernetes/so/charts/so-sdc-controller/values.yaml
+++ b/kubernetes/so/charts/so-sdc-controller/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -72,8 +72,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 nodeSelector: {}
diff --git a/kubernetes/so/charts/so-sdnc-adapter/values.yaml b/kubernetes/so/charts/so-sdnc-adapter/values.yaml
index a24eddc..d51ed74 100755
--- a/kubernetes/so/charts/so-sdnc-adapter/values.yaml
+++ b/kubernetes/so/charts/so-sdnc-adapter/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
diff --git a/kubernetes/so/charts/so-vfc-adapter/templates/deployment.yaml b/kubernetes/so/charts/so-vfc-adapter/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/charts/so-vfc-adapter/templates/deployment.yaml
+++ b/kubernetes/so/charts/so-vfc-adapter/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/charts/so-vfc-adapter/values.yaml b/kubernetes/so/charts/so-vfc-adapter/values.yaml
index 08a7839..efe9472 100755
--- a/kubernetes/so/charts/so-vfc-adapter/values.yaml
+++ b/kubernetes/so/charts/so-vfc-adapter/values.yaml
@@ -19,7 +19,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -72,8 +72,6 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
 ingress:
   enabled: false
 nodeSelector: {}
diff --git a/kubernetes/so/charts/so-vnfm-adapter/values.yaml b/kubernetes/so/charts/so-vnfm-adapter/values.yaml
index cc04501..d544247 100755
--- a/kubernetes/so/charts/so-vnfm-adapter/values.yaml
+++ b/kubernetes/so/charts/so-vnfm-adapter/values.yaml
@@ -18,7 +18,7 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   persistence:
     mountPath: /dockerdata-nfs
 
diff --git a/kubernetes/so/requirements.yaml b/kubernetes/so/requirements.yaml
index 12e77c3..237486d 100755
--- a/kubernetes/so/requirements.yaml
+++ b/kubernetes/so/requirements.yaml
@@ -17,4 +17,8 @@
     # local reference to common chart, as it is
     # a part of this chart's package and will not
     # be published independently to a repo (at this point)
-    repository: '@local'
\ No newline at end of file
+    repository: '@local'
+  - name: mariadb-galera
+    version: ~4.x-0
+    repository: '@local'
+    condition: global.mariadbGalera.localCluster
diff --git a/kubernetes/so/templates/deployment.yaml b/kubernetes/so/templates/deployment.yaml
index ad3a19f..9211571 100755
--- a/kubernetes/so/templates/deployment.yaml
+++ b/kubernetes/so/templates/deployment.yaml
@@ -36,10 +36,10 @@
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /root/job_complete.py
         args:
-        - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - --job-name
+        - {{ .Release.Name }}-so-mariadb-config-job
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/so/values.yaml b/kubernetes/so/values.yaml
index 1a59cea..b2c0161 100755
--- a/kubernetes/so/values.yaml
+++ b/kubernetes/so/values.yaml
@@ -19,10 +19,26 @@
   nodePortPrefixExt: 304
   repository: nexus3.onap.org:10001
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
+  mariadbGalera:
+    nameOverride: mariadb-galera
+    serviceName: mariadb-galera
+    servicePort: "3306"
+    mariadbRootPassword: secretpassword
+    #This flag allows SO to instantiate its own mariadb-galera cluster, 
+    #serviceName and nameOverride should be so-mariadb-galera if this flag is enabled
+    localCluster: false
   persistence:
     mountPath: /dockerdata-nfs
-
+  #This configuration will run the migration. The configurations are for backing up the data
+  #from DB and then restoring it to the present versions preferred DB.
+  migration:
+    enabled: false
+    dbHost: mariadb-galera
+    dbPort: 3306
+    dbUser: root
+    dbPassword: secretpassword
+    
 #################################################################
 # Application configuration defaults.
 #################################################################
@@ -72,25 +88,20 @@
     timeoutSeconds: 10
     successThreshold: 1
     failureThreshold: 3
-mariadb:
-  nameOverride: so-mariadb
-so-bpmn-infra:
-  mariadb:
-    nameOverride: so-mariadb
-so-catalog-db-adapter:
-  mariadb:
-    nameOverride: so-mariadb
-so-openstack-adapter:
-  mariadb:
-    nameOverride: so-mariadb
-so-request-db-adapter:
-  mariadb:
-    nameOverride: so-mariadb
-so-sdc-controller:
-  mariadb:
-    nameOverride: so-mariadb
-so-vfc-adapter:
-  mariadb:
-    nameOverride: so-mariadb
+
 nodeSelector: {}
 affinity: {}
+
+#Used only if localCluster is enabled. Instantiates SO's own cassandra cluster
+#helm deploy demo local/onap --namespace onap --verbose --set so.enabled=true \
+#                                                       --set so.global.mariadbGalera.localCluster=true \
+#                                                       --set so.global.mariadbGalera.nameOverride=so-mariadb-galera \
+#                                                       --set so.global.mariadbGalera.serviceName=so-mariadb-galera
+mariadb-galera:
+  nameOverride: so-mariadb-galera
+  replicaCount: 1
+  service:
+    name: so-mariadb-galera
+  persistence:
+    mountSubPath: so/mariadb-galera/data
+    enabled: true