Run all components in one namespace

Change-Id: I5fcd4d577c1fda4de27842807c7cf7a5d372756e
Issue-ID: OOM-722
Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
diff --git a/kubernetes/sdnc/templates/all-services.yaml b/kubernetes/sdnc/templates/all-services.yaml
index 9425ef4..c309f48 100644
--- a/kubernetes/sdnc/templates/all-services.yaml
+++ b/kubernetes/sdnc/templates/all-services.yaml
@@ -3,7 +3,7 @@
 kind: Service
 metadata:
   name: dbhost
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-dbhost
 spec:
@@ -19,7 +19,7 @@
 kind: Service
 metadata:
   name: dbhost-read
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-dbhost
 spec:
@@ -33,7 +33,7 @@
 kind: Service
 metadata:
   name: sdnctldb01
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-dbhost
 spec:
@@ -47,7 +47,7 @@
 kind: Service
 metadata:
   name: sdnctldb02
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-dbhost
 spec:
@@ -63,7 +63,7 @@
 kind: Service
 metadata:
   name: sdnc-dgbuilder
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-dgbuilder
 spec:
@@ -80,7 +80,7 @@
 kind: Service
 metadata:
   name: sdnhost
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc
   annotations:
@@ -117,7 +117,7 @@
 apiVersion: v1
 metadata:
   name: nfs-provisioner
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: nfs-provisioner
 spec:
@@ -140,7 +140,7 @@
 kind: Service
 metadata:
   name: sdnc-portal
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc-portal
   annotations:
@@ -169,7 +169,7 @@
 kind: Service
 metadata:
   name: sdnhost-cluster
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: sdnc
   annotations:
diff --git a/kubernetes/sdnc/templates/db-statefulset.yaml b/kubernetes/sdnc/templates/db-statefulset.yaml
index f2e079d..399eb42 100644
--- a/kubernetes/sdnc/templates/db-statefulset.yaml
+++ b/kubernetes/sdnc/templates/db-statefulset.yaml
@@ -3,7 +3,7 @@
 kind: StatefulSet
 metadata:
   name: sdnc-dbhost
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   serviceName: "dbhost"
   replicas: {{ .Values.numberOfDbReplicas }}
@@ -61,7 +61,7 @@
           echo ${BASH_REMATCH}
           [[ $ordinal -eq 0 ]] && exit 0
           # Clone data from previous peer.
-          ncat --recv-only sdnc-dbhost-$(($ordinal-1)).dbhost.{{ .Values.nsPrefix }}-sdnc 3307 | xbstream -x -C /var/lib/mysql
+          ncat --recv-only sdnc-dbhost-$(($ordinal-1)).dbhost.{{ .Values.nsPrefix }} 3307 | xbstream -x -C /var/lib/mysql
           # Prepare the backup.
           xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --prepare --target-dir=/var/lib/mysql
           ls -l /var/lib/mysql
@@ -150,7 +150,7 @@
             mv change_master_to.sql.in change_master_to.sql.orig
             mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h 127.0.0.1 <<EOF
           $(<change_master_to.sql.orig),
-            MASTER_HOST="sdnc-dbhost-0.dbhost.{{ .Values.nsPrefix }}-sdnc",
+            MASTER_HOST="sdnc-dbhost-0.dbhost.{{ .Values.nsPrefix }}",
             MASTER_USER="root",
             MASTER_PASSWORD="$MYSQL_ROOT_PASSWORD",
             MASTER_CONNECT_RETRY=10;
@@ -176,10 +176,15 @@
         emptyDir: {}
       - name: config-map
         configMap:
-          name: mysql
+          name: sdnc-mysql
       - name: localtime
         hostPath:
           path: /etc/localtime
+#{{ if .Values.disableNfsProvisioner }}
+      - name: sdnc-data
+        hostPath:
+          path: /dockerdata-nfs/{{ .Values.nsPrefix }}/sdnc/data
+#{{ else }}
   volumeClaimTemplates:
   - metadata:
       name: sdnc-data
@@ -191,3 +196,4 @@
         requests:
           storage: 1Gi
 #{{ end }}
+#{{ end }}
diff --git a/kubernetes/sdnc/templates/dgbuilder-deployment.yaml b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
index b9ec155..78e20da 100644
--- a/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
+++ b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml
@@ -3,7 +3,7 @@
 kind: Deployment
 metadata:
   name: sdnc-dgbuilder
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.dgbuilderReplicas }}
   selector:
diff --git a/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml b/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml
index efd7d6d..c27ae72 100644
--- a/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml
+++ b/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml
@@ -3,7 +3,7 @@
 kind: ConfigMap
 metadata:
   name: sdnc-dmaap-configmap
-  namespace: {{ .Values.nsPrefix }}-sdnc
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ tpl (.Files.Glob "resources/config/dmaap/*").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/sdnc/templates/dmaap-deployment.yaml b/kubernetes/sdnc/templates/dmaap-deployment.yaml
index eb6f354..97dc773 100644
--- a/kubernetes/sdnc/templates/dmaap-deployment.yaml
+++ b/kubernetes/sdnc/templates/dmaap-deployment.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: dmaap-listener
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  name: sdnc-dmaap-listener
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.dmaapReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: dmaap-listener
-      name: dmaap-listener
+      name: sdnc-dmaap-listener
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/sdnc/templates/mysql-configmap.yaml b/kubernetes/sdnc/templates/mysql-configmap.yaml
index deaa997..6b4cdcb 100644
--- a/kubernetes/sdnc/templates/mysql-configmap.yaml
+++ b/kubernetes/sdnc/templates/mysql-configmap.yaml
@@ -1,8 +1,8 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: mysql
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  name: sdnc-mysql
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: mysql
 data:
diff --git a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
index 9e78bf3..bd161d5 100644
--- a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
+++ b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml
@@ -1,9 +1,10 @@
 #{{ if not .Values.disableSdncSdncDbhost }}
+#{{ if not .Values.disableNfsProvisioner }}
 kind: Deployment
 apiVersion: extensions/v1beta1
 metadata:
-  name: nfs-provisioner
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  name: sdnc-nfs-provisioner
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.nfsReplicas }}
   strategy:
@@ -12,6 +13,7 @@
     metadata:
       labels:
         app: nfs-provisioner
+      name: sdnc-nfs-provisioner
     spec:
       containers:
         - name: nfs-provisioner
@@ -53,3 +55,4 @@
           hostPath:
             path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/sdnc/data
 #{{ end }}
+#{{ end }}
diff --git a/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml b/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml
index e7cde3b..d60cae7 100644
--- a/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml
+++ b/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml
@@ -3,7 +3,7 @@
 kind: ConfigMap
 metadata:
   name: sdnc-conf-configmap
-  namespace: {{ .Values.nsPrefix }}-sdnc
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ tpl (.Files.Glob "resources/config/conf/*").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml b/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml
index 7c46cf4..d6d4eae 100644
--- a/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml
+++ b/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml
@@ -1,8 +1,10 @@
 #{{ if not .Values.disableSdncSdncDbhost }}
+#{{ if not .Values.disableNfsProvisioner }}
 kind: StorageClass
 apiVersion: storage.k8s.io/v1
 metadata:
   name: "{{ .Values.nsPrefix }}-sdnc-data"
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
 provisioner: sdnc/nfs
 #{{ end }}
+#{{ end }}
diff --git a/kubernetes/sdnc/templates/sdnc-log-configmap.yaml b/kubernetes/sdnc/templates/sdnc-log-configmap.yaml
index d13daac..a7cada8 100644
--- a/kubernetes/sdnc/templates/sdnc-log-configmap.yaml
+++ b/kubernetes/sdnc/templates/sdnc-log-configmap.yaml
@@ -3,7 +3,7 @@
 kind: ConfigMap
 metadata:
   name: sdnc-log-configmap
-  namespace: {{ .Values.nsPrefix }}-sdnc
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ tpl (.Files.Glob "resources/config/log/filebeat/log4j/*").AsConfig . | indent 2 }}
 ---
@@ -11,7 +11,7 @@
 kind: ConfigMap
 metadata:
   name: sdnc-logging-cfg-configmap
-  namespace: {{ .Values.nsPrefix }}-sdnc
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/sdnc/templates/sdnc-statefulset.yaml b/kubernetes/sdnc/templates/sdnc-statefulset.yaml
index 02950ba..1f02037 100644
--- a/kubernetes/sdnc/templates/sdnc-statefulset.yaml
+++ b/kubernetes/sdnc/templates/sdnc-statefulset.yaml
@@ -3,7 +3,7 @@
 kind: StatefulSet
 metadata:
   name: sdnc
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   serviceName: "sdnhost-cluster"
   replicas: {{ .Values.numberOfODLReplicas }}
@@ -37,8 +37,8 @@
         - bash
         - "-c"
         - |
-          sed -i 's/dbhost/sdnc-dbhost-0.dbhost.onap-sdnc.svc.cluster.local/g' /opt/onap/sdnc/data/properties/svclogic.properties
-          sed -i 's/^\(org.onap.ccsdk.sli.jdbc.hosts=\).*/\1sdnc-dbhost-0.dbhost.onap-sdnc.svc.cluster.local/' /opt/onap/sdnc/data/properties/dblib.properties
+          sed -i 's/dbhost/sdnc-dbhost-0.dbhost.{{ .Values.nsPrefix }}.svc.cluster.local/g' /opt/onap/sdnc/data/properties/svclogic.properties
+          sed -i 's/^\(org.onap.ccsdk.sli.jdbc.hosts=\).*/\1sdnc-dbhost-0.dbhost.{{ .Values.nsPrefix }}.svc.cluster.local/' /opt/onap/sdnc/data/properties/dblib.properties
           /opt/onap/sdnc/bin/startODL.sh
         env:
         - name: MYSQL_ROOT_PASSWORD
diff --git a/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml b/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml
index 4970de0..6aeaa9f 100644
--- a/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml
+++ b/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml
@@ -3,7 +3,7 @@
 kind: ConfigMap
 metadata:
   name: sdnc-ueb-configmap
-  namespace: {{ .Values.nsPrefix }}-sdnc
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ tpl (.Files.Glob "resources/config/ueb/*").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/sdnc/templates/ueb-deployment.yaml b/kubernetes/sdnc/templates/ueb-deployment.yaml
index c109acd..b869ca9 100644
--- a/kubernetes/sdnc/templates/ueb-deployment.yaml
+++ b/kubernetes/sdnc/templates/ueb-deployment.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: ueb-listener
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  name: sdnc-ueb-listener
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.uebReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: ueb-listener
-      name: ueb-listener
+      name: sdnc-ueb-listener
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/sdnc/templates/web-deployment.yaml b/kubernetes/sdnc/templates/web-deployment.yaml
index 73d8e0a..968ec8d 100644
--- a/kubernetes/sdnc/templates/web-deployment.yaml
+++ b/kubernetes/sdnc/templates/web-deployment.yaml
@@ -3,7 +3,7 @@
 kind: Deployment
 metadata:
   name: sdnc-portal
-  namespace: "{{ .Values.nsPrefix }}-sdnc"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.portalReplicas }}
   selector: