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/policy/templates/all-services.yaml b/kubernetes/policy/templates/all-services.yaml
index c6b633e..3971b29 100644
--- a/kubernetes/policy/templates/all-services.yaml
+++ b/kubernetes/policy/templates/all-services.yaml
@@ -3,7 +3,7 @@
 kind: Service
 metadata:
   name: mariadb
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: mariadb
 spec:
@@ -22,7 +22,7 @@
   labels:
     app: nexus
   name: nexus
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   ports:
   - name: nexus-port
@@ -39,7 +39,7 @@
   labels:
     app: drools
   name: drools
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   ports:
   - name: "drools-port"
@@ -58,7 +58,7 @@
 kind: Service
 metadata:
   name: pap
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: pap
 spec:
@@ -79,7 +79,7 @@
 kind: Service
 metadata:
   name: pdp
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: pdp
   annotations:
@@ -117,7 +117,7 @@
 kind: Service
 metadata:
   name: brmsgw
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: brmsgw
 spec:
diff --git a/kubernetes/policy/templates/dep-brmsgw.yaml b/kubernetes/policy/templates/dep-brmsgw.yaml
index 6c0533c..25bf0c6 100644
--- a/kubernetes/policy/templates/dep-brmsgw.yaml
+++ b/kubernetes/policy/templates/dep-brmsgw.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: brmsgw
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-brmsgw
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.brmsgwReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: brmsgw
-      name: brmsgw
+      name: policy-brmsgw
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/policy/templates/dep-drools.yaml b/kubernetes/policy/templates/dep-drools.yaml
index 1dc16cf..ef9636c 100644
--- a/kubernetes/policy/templates/dep-drools.yaml
+++ b/kubernetes/policy/templates/dep-drools.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: drools
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-drools
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.droolsReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: drools
-      name: drools
+      name: policy-drools
     spec:
       initContainers:
       - command:
@@ -55,8 +55,21 @@
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
-        - mountPath: /tmp/policy-install/config
-          name: drools
+        - mountPath: /tmp/policy-install/config/policy-keystore
+          name: drools-secret
+          subPath: policy-keystore
+        - mountPath: /tmp/policy-install/config/feature-healthcheck.conf
+          name: drools-secret
+          subPath: feature-healthcheck.conf
+        - mountPath: /tmp/policy-install/config/base.conf
+          name: drools-config
+          subPath: base.conf
+        - mountPath: /tmp/policy-install/config/policy-management.conf
+          name: drools-config
+          subPath: policy-management.conf
+        - mountPath: /tmp/policy-install/config/drools-tweaks.sh
+          name: drools-config
+          subPath: drools-tweaks.sh
         - mountPath: /usr/share/maven/conf/settings.xml
           name: drools-settingsxml
           subPath: settings.xml
@@ -97,16 +110,10 @@
         - name: drools-settingsxml
           configMap:
             name: policy-dep-drools-settings-configmap
-        - name: drools
-          secret:
-            secretName: policy-dep-drools-secret
+        - name: drools-config
+          configMap:
+            name: policy-dep-drools-configmap
             items:
-            - key: policy-keystore
-              path: policy-keystore
-              mode: 0644
-            - key: feature-healthcheck.conf
-              path: feature-healthcheck.conf
-              mode: 0644
             - key: base.conf
               path: base.conf
               mode: 0755
@@ -116,6 +123,16 @@
             - key: drools-tweaks.sh
               path: drools-tweaks.sh
               mode: 0755
+        - name: drools-secret
+          secret:
+            secretName: policy-dep-drools-secret
+            items:
+            - key: policy-keystore
+              path: policy-keystore
+              mode: 0644
+            - key: feature-healthcheck.conf
+              path: feature-healthcheck.conf
+              mode: 0644
       imagePullSecrets:
       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
 #{{ end }}
diff --git a/kubernetes/policy/templates/dep-maria.yaml b/kubernetes/policy/templates/dep-maria.yaml
index e42230f..9ac17da 100644
--- a/kubernetes/policy/templates/dep-maria.yaml
+++ b/kubernetes/policy/templates/dep-maria.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: mariadb
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-mariadb
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.mariadbReplicas }}
   selector:
@@ -13,6 +13,7 @@
     metadata:
       labels:
         app: mariadb
+      name: policy-mariadb
     spec:
       hostname: mariadb
       containers:
diff --git a/kubernetes/policy/templates/dep-nexus.yaml b/kubernetes/policy/templates/dep-nexus.yaml
index 2db40b2..c63e0af 100644
--- a/kubernetes/policy/templates/dep-nexus.yaml
+++ b/kubernetes/policy/templates/dep-nexus.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: nexus
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-nexus
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.nexusReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: nexus
-      name: nexus
+      name: policy-nexus
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/policy/templates/dep-pap.yaml b/kubernetes/policy/templates/dep-pap.yaml
index 68ccb5a..389fc6b 100644
--- a/kubernetes/policy/templates/dep-pap.yaml
+++ b/kubernetes/policy/templates/dep-pap.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: pap
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-pap
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.papReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: pap
-      name: pap
+      name: policy-pap
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/policy/templates/dep-pdp.yaml b/kubernetes/policy/templates/dep-pdp.yaml
index f867fa5..6740f1d 100644
--- a/kubernetes/policy/templates/dep-pdp.yaml
+++ b/kubernetes/policy/templates/dep-pdp.yaml
@@ -2,8 +2,8 @@
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
-  name: pdp
-  namespace: "{{ .Values.nsPrefix }}-policy"
+  name: policy-pdp
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   replicas: {{ .Values.pdpReplicas }}
   selector:
@@ -13,7 +13,7 @@
     metadata:
       labels:
         app: pdp
-      name: pdp
+      name: policy-pdp
     spec:
       initContainers:
       - command:
diff --git a/kubernetes/policy/templates/policy-deployment-configmap.yaml b/kubernetes/policy/templates/policy-deployment-configmap.yaml
index b1db02b..d59ba61 100644
--- a/kubernetes/policy/templates/policy-deployment-configmap.yaml
+++ b/kubernetes/policy/templates/policy-deployment-configmap.yaml
@@ -3,9 +3,9 @@
 kind: ConfigMap
 metadata:
   name: policy-dep-drools-settings-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/drools/settings.xml").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/drools/settings.xml").AsConfig . | indent 2 }}
 #{{ end }}
 ---
 #{{ if not .Values.disablePolicyPdp }}
@@ -13,7 +13,15 @@
 kind: ConfigMap
 metadata:
   name: policy-dep-pe-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/opt/policy/config/pe/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/opt/policy/config/pe/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: policy-dep-drools-configmap
+  namespace: {{ .Values.nsPrefix }}
+data:
+{{ tpl (.Files.Glob "resources/config/opt/policy/config/drools/*").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/policy/templates/policy-deployment-secret.yaml b/kubernetes/policy/templates/policy-deployment-secret.yaml
index 99a807b..6fe52ea 100644
--- a/kubernetes/policy/templates/policy-deployment-secret.yaml
+++ b/kubernetes/policy/templates/policy-deployment-secret.yaml
@@ -3,8 +3,8 @@
 kind: Secret
 metadata:
   name: policy-dep-drools-secret
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 type: Opaque
 data:
-{{ tpl (.Files.Glob "resources/config/opt/policy/config/drools/*").AsSecrets . | indent 2 }}
+{{ (.Files.Glob "resources/config/opt/policy/config/drools/keys/*").AsSecrets | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/policy/templates/policy-log-configmap.yaml b/kubernetes/policy/templates/policy-log-configmap.yaml
index 24ad45e..b1a9e09 100644
--- a/kubernetes/policy/templates/policy-log-configmap.yaml
+++ b/kubernetes/policy/templates/policy-log-configmap.yaml
@@ -3,25 +3,25 @@
 kind: ConfigMap
 metadata:
   name: policy-pap-log-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/log/xacml-pap-rest/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/xacml-pap-rest/*").AsConfig . | indent 2 }}
 ---
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: policy-sdk-log-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/log/ep_sdk_app/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/ep_sdk_app/*").AsConfig . | indent 2 }}
 ---
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: policy-filebeat-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{  (.Files.Glob "resources/config/log/filebeat/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }}
 #{{ end }}
 #{{ if not .Values.disablePolicyPdp }}
 ---
@@ -29,9 +29,9 @@
 kind: ConfigMap
 metadata:
   name: policy-pdp-log-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/log/xacml-pdp-rest/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/xacml-pdp-rest/*").AsConfig . | indent 2 }}
 #{{ end }}
 #{{ if not .Values.disablePolicyDrools }}
 ---
@@ -39,7 +39,7 @@
 kind: ConfigMap
 metadata:
   name: policy-drools-log-configmap
-  namespace: {{ .Values.nsPrefix }}-policy
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/config/log/drools/*").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/drools/*").AsConfig . | indent 2 }}
 #{{ end }}