refactor helm files to use namespace prefix

-removed the full namespace from each template.  better lets us reuse
variables.
-made secret end up in a configurable namespace
-fixed some bugs where secrets were missing
-updated createAll and delete to make use of namespace prefix
removing the need for seds to replace the word onap.

*** all containers at this point come up in my env. except for
aai model loader which is failing cause its still at 1.0
and its trying to talk to a 1.1 sdc and it doesnt auth properly. ***

Issue-ID:OOM-215

Change-Id: I15815a01469786a391e272fde4bdaa53ff48091c
Signed-off-by: Mandeep Khinda <mandeep.khinda@amdocs.com>
diff --git a/kubernetes/portal/templates/all-services.yaml b/kubernetes/portal/templates/all-services.yaml
index 488fb80..2107e2a 100644
--- a/kubernetes/portal/templates/all-services.yaml
+++ b/kubernetes/portal/templates/all-services.yaml
@@ -2,7 +2,7 @@
 kind: Service
 metadata:
   name: portaldb
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
   labels:
     app: portaldb
 spec:
@@ -19,7 +19,7 @@
   labels:
     app: portalapps
   name: portalapps
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   ports:
   - name: portal-1
@@ -44,7 +44,7 @@
   labels:
     app: vnc-portal
   name: vnc-portal
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   ports:
   - name: tcp-1
@@ -63,7 +63,7 @@
 kind: Service
 metadata:
   name: portalwidgets
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
   labels:
     app: portalwidgets
 spec:
diff --git a/kubernetes/portal/templates/portal-apps-deployment.yaml b/kubernetes/portal/templates/portal-apps-deployment.yaml
index 23a6459..a0818fa 100755
--- a/kubernetes/portal/templates/portal-apps-deployment.yaml
+++ b/kubernetes/portal/templates/portal-apps-deployment.yaml
@@ -2,7 +2,7 @@
 kind: Deployment
 metadata:
   name: portalapps
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   selector:
     matchLabels:
@@ -102,45 +102,45 @@
       volumes:
         - name: portal-fusion-properties
           hostPath:
-            path:  /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/fusion.properties
+            path:  /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/fusion.properties
         - name: portal-openid-connect-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/openid-connect.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/openid-connect.properties
         - name: portal-system-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/system.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/system.properties
         - name: portal-portal-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/portal.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPPORTALAPP/portal.properties
         - name: dbcapp-fusion-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPDBCAPP/fusion.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPDBCAPP/fusion.properties
         - name: dbcapp-system-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPDBCAPP/system.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPDBCAPP/system.properties
         - name: dbcapp-portal-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPDBCAPP/portal.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPDBCAPP/portal.properties
         - name: dbcapp-dbcapp-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPDBCAPP/dbcapp.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPDBCAPP/dbcapp.properties
         - name: sdkapp-system-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPSDKAPP/system.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPSDKAPP/system.properties
         - name: sdkapp-portal-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPSDKAPP/portal.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPSDKAPP/portal.properties
         - name: sdkapp-fusion-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPSDKAPP/fusion.properties            
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPSDKAPP/fusion.properties            
         - name: portal-mariadb-onboarding-sql
           hostPath:
-            path: /dockerdata-nfs/onap/portal/mariadb/oom_updates.sql
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/mariadb/oom_updates.sql
         - name: portal-root
           hostPath:
-            path: /dockerdata-nfs/onap/portal
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal
         - name: portal-logs
           hostPath:
-            path: /dockerdata-nfs/onap/portal/logs
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/logs
       imagePullSecrets:
-      - name: onap-docker-registry-key
+      - name: "{{ .Values.nsPrefix }}-docker-registry-key"
diff --git a/kubernetes/portal/templates/portal-mariadb-deployment.yaml b/kubernetes/portal/templates/portal-mariadb-deployment.yaml
index cf8bbd6..a31c6a2 100755
--- a/kubernetes/portal/templates/portal-mariadb-deployment.yaml
+++ b/kubernetes/portal/templates/portal-mariadb-deployment.yaml
@@ -2,7 +2,7 @@
 kind: Deployment
 metadata:
   name: portaldb
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   selector:
     matchLabels:
@@ -19,7 +19,7 @@
         name: "portaldb"
         env:
         - name: MYSQL_HOST
-          value: portaldb.onap-portal
+          value: "portaldb.{{ .Values.nsPrefix }}-portal"
         - name: MYSQL_ROOT_PASSWORD
           value: password
         volumeMounts:
@@ -36,6 +36,6 @@
       volumes:
       - name: portal-mariadb-data
         hostPath:
-          path: /dockerdata-nfs/onap/portal/mariadb/data
+          path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/mariadb/data
       imagePullSecrets:
-      - name: onap-docker-registry-key
+      - name: "{{ .Values.nsPrefix }}-docker-registry-key"
diff --git a/kubernetes/portal/templates/portal-vnc-dep.yaml b/kubernetes/portal/templates/portal-vnc-dep.yaml
index e4a8574..fb7bd93 100644
--- a/kubernetes/portal/templates/portal-vnc-dep.yaml
+++ b/kubernetes/portal/templates/portal-vnc-dep.yaml
@@ -4,7 +4,7 @@
   labels:
     app: vnc-portal
   name: vnc-portal
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   selector:
     matchLabels:
@@ -50,7 +50,7 @@
               "env": [
                   {
                       "name": "NAMESPACE",
-                      "value": "onap-policy"
+                      "value": "{{ .Values.nsPrefix }}-policy"
                   }
               ],
               "image": "{{ .Values.image.readiness }}",
@@ -68,7 +68,7 @@
               "env": [
                   {
                       "name": "NAMESPACE",
-                      "value": "onap-sdc"
+                      "value": "{{ .Values.nsPrefix }}-sdc"
                   }
               ],
               "image": "{{ .Values.image.readiness }}",
@@ -86,7 +86,7 @@
               "env": [
                   {
                       "name": "NAMESPACE",
-                      "value": "onap-vid"
+                      "value": "{{ .Values.nsPrefix }}-vid"
                   }
               ],
               "image": "{{ .Values.image.readiness }}",
@@ -95,7 +95,7 @@
           },
           {
               "command": ["/bin/sh","-c"],
-              "args": ["echo `host sdc-be.onap-sdc | awk ''{print$4}''` sdc.api.be.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host portalapps.onap-portal | awk ''{print$4}''` portal.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host pap.onap-policy | awk ''{print$4}''` policy.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host sdc-fe.onap-sdc | awk ''{print$4}''` sdc.ui.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host vid-server.onap-vid | awk ''{print$4}''` vid.api.simpledemo.openecomp.org >> /ubuntu-init/hosts; echo `host sparky-fe.onap-aai | awk ''{print$4}''` aai.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts"],
+              "args": ["echo `host sdc-be.{{ .Values.nsPrefix }}-sdc | awk ''{print$4}''` sdc.api.be.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host portalapps.{{ .Values.nsPrefix }}-portal | awk ''{print$4}''` portal.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host pap.{{ .Values.nsPrefix }}-policy | awk ''{print$4}''` policy.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host sdc-fe.{{ .Values.nsPrefix }}-sdc | awk ''{print$4}''` sdc.ui.simpledemo.openecomp.org  >> /ubuntu-init/hosts; echo `host vid-server.{{ .Values.nsPrefix }}-vid | awk ''{print$4}''` vid.api.simpledemo.openecomp.org >> /ubuntu-init/hosts; echo `host sparky-fe.{{ .Values.nsPrefix }}-aai | awk ''{print$4}''` aai.api.simpledemo.openecomp.org  >> /ubuntu-init/hosts"],
               "image": "{{ .Values.image.ubuntuInit }}",
               "imagePullPolicy": "{{ .Values.pullPolicy }}",
               "name": "vnc-init-hosts",
@@ -118,7 +118,6 @@
         env:
         - name: VNC_PASSWORD
           value: password
-        imagePullPolicy: IfNotPresent
         name: vnc-portal
         volumeMounts:
         - mountPath: /ubuntu-init/
@@ -130,4 +129,4 @@
         - name: ubuntu-init
           emptyDir: {}
       imagePullSecrets:
-      - name: onap-docker-registry-key
+      - name: "{{ .Values.nsPrefix }}-docker-registry-key"
diff --git a/kubernetes/portal/templates/portal-widgets-deployment.yaml b/kubernetes/portal/templates/portal-widgets-deployment.yaml
index 0aea756..5b020e5 100644
--- a/kubernetes/portal/templates/portal-widgets-deployment.yaml
+++ b/kubernetes/portal/templates/portal-widgets-deployment.yaml
@@ -2,7 +2,7 @@
 kind: Deployment
 metadata:
   name: portalwidgets
-  namespace: {{ .Values.NS }}
+  namespace: "{{ .Values.nsPrefix }}-portal"
 spec:
   selector:
     matchLabels:
@@ -56,4 +56,6 @@
       volumes:
         - name: portalwidgets-application-properties
           hostPath:
-            path: /dockerdata-nfs/onap/portal/portal-fe/webapps/etc/ECOMPWIDGETMS/application.properties
+            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/portal/portal-fe/webapps/etc/ECOMPWIDGETMS/application.properties
+      imagePullSecrets:
+      - name: "{{ .Values.nsPrefix }}-docker-registry-key"
\ No newline at end of file