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/log/resources/elasticsearch/conf/elasticsearch.yml b/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
index 0b579d0..f038a10 100644
--- a/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
+++ b/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
@@ -86,7 +86,7 @@
 # By default, Elasticsearch will bind to the available loopback addresses and will scan ports 9300 to 9305 to try
 # to connect to other nodes running on the same server.
 #
-#discovery.zen.ping.unicast.hosts: ["elasticsearch.onap-log"
+#discovery.zen.ping.unicast.hosts: ["elasticsearch.{{.Values.nsPrefix}}"
 #$discovery.zen.ping.unicast.hosts
 #
 # This setting tells Elasticsearch to not elect a master unless there are enough master-eligible nodes
diff --git a/kubernetes/log/resources/kibana/conf/kibana.yml b/kubernetes/log/resources/kibana/conf/kibana.yml
index 3b96bd3..df0d71a 100644
--- a/kubernetes/log/resources/kibana/conf/kibana.yml
+++ b/kubernetes/log/resources/kibana/conf/kibana.yml
@@ -31,8 +31,8 @@
 
 # The URL of the Elasticsearch instance to use for all your queries.
 # OOM-427, OOM-441 hardcoded onap workspace to avoid helm upgrade past 2.3
-elasticsearch.url: "http://elasticsearch.onap-log:9200"
-#elasticsearch-service.onap-log:9200"
+elasticsearch.url: "http://elasticsearch.{{.Values.nsPrefix}}:9200"
+#elasticsearch-service.{{.Values.nsPrefix}}:9200"
 #elasticsearch.url: "http://10.247.47.3:9200"
 # When this setting's value is true Kibana uses the hostname specified in the server.host
 # setting. When the value of this setting is false, Kibana uses the hostname of the host
diff --git a/kubernetes/log/resources/logstash/pipeline/onap-pipeline.conf b/kubernetes/log/resources/logstash/pipeline/onap-pipeline.conf
index 123ceb5..8289b49 100644
--- a/kubernetes/log/resources/logstash/pipeline/onap-pipeline.conf
+++ b/kubernetes/log/resources/logstash/pipeline/onap-pipeline.conf
@@ -225,7 +225,7 @@
 #can specify one or a list of hosts. If sniffing is set, one is enough and others will be auto-discovered
 ##Also protocol can be specified like ["http://10.247.186.12:9200"]
 ## OOM-427, OOM-441 hardcoded onap workspace to avoid helm upgrade past 2.3
- hosts => ["http://elasticsearch.onap-log:9200"]
+ hosts => ["http://elasticsearch.{{.Values.nsPrefix}}:9200"]
 
 
  ## This setting asks Elasticsearch for the list of all cluster nodes and adds them to the hosts list. Default is false.
diff --git a/kubernetes/log/templates/all-services.yaml b/kubernetes/log/templates/all-services.yaml
index e8b6b81..a40a4da 100644
--- a/kubernetes/log/templates/all-services.yaml
+++ b/kubernetes/log/templates/all-services.yaml
@@ -5,7 +5,7 @@
   labels:
     app: elasticsearch
   name: elasticsearch
-  namespace: {{ .Values.nsPrefix }}-log
+  namespace: {{ .Values.nsPrefix }}
 spec:
   ports:
   - name: http
@@ -20,7 +20,7 @@
 kind: Service
 metadata:
   name: elasticsearchtcp
-  namespace: {{ .Values.nsPrefix }}-log
+  namespace: {{ .Values.nsPrefix }}
   labels:
     app: elasticsearch
 spec:
@@ -37,7 +37,7 @@
 kind: Service
 metadata:
   name: logstashinternal
-  namespace: {{ .Values.nsPrefix }}-log
+  namespace: {{ .Values.nsPrefix }}
   labels:
     app: logstash
 spec:
@@ -52,7 +52,7 @@
 kind: Service
 metadata:
   name: logstash
-  namespace: {{ .Values.nsPrefix }}-log
+  namespace: {{ .Values.nsPrefix }}
   labels:
     app: logstash
 spec:
@@ -71,7 +71,7 @@
   labels:
     app: kibana
   name: kibana
-  namespace: {{ .Values.nsPrefix }}-log
+  namespace: {{ .Values.nsPrefix }}
 spec:
   ports:
   - name: tcp-ks
diff --git a/kubernetes/log/templates/elasticsearch-deployment.yaml b/kubernetes/log/templates/elasticsearch-deployment.yaml
index 85e5746..2b596d2 100644
--- a/kubernetes/log/templates/elasticsearch-deployment.yaml
+++ b/kubernetes/log/templates/elasticsearch-deployment.yaml
@@ -4,8 +4,8 @@
 metadata:
   labels:
     app: elasticsearch
-  name: elasticsearch
-  namespace: {{ .Values.nsPrefix }}-log
+  name: log-elasticsearch
+  namespace: {{ .Values.nsPrefix }}
 spec:
   selector:
     matchLabels:
@@ -14,7 +14,7 @@
     metadata:
       labels:
         app: elasticsearch
-      name: elasticsearch
+      name: log-elasticsearch
     spec:
       initContainers:
       - command:
@@ -70,7 +70,7 @@
             path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/log/
         - name: elasticsearch-conf
           configMap:
-            name: elasticsearch-configmap
+            name: log-elasticsearch-configmap
             items:
             - key: elasticsearch.yml
               path: elasticsearch.yml
@@ -78,8 +78,8 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: elasticsearch-configmap
-  namespace: {{ .Values.nsPrefix }}-log
+  name: log-elasticsearch-configmap
+  namespace: {{ .Values.nsPrefix }}
 data:
 {{ (.Files.Glob "resources/elasticsearch/conf/elasticsearch.yml").AsConfig | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/log/templates/kibana-deployment.yaml b/kubernetes/log/templates/kibana-deployment.yaml
index 2de825e..f627a3c 100644
--- a/kubernetes/log/templates/kibana-deployment.yaml
+++ b/kubernetes/log/templates/kibana-deployment.yaml
@@ -4,8 +4,8 @@
 metadata:
   labels:
     app: kibana
-  name: kibana
-  namespace: {{ .Values.nsPrefix }}-log
+  name: log-kibana
+  namespace: {{ .Values.nsPrefix }}
 spec:
   selector:
     matchLabels:
@@ -14,7 +14,7 @@
     metadata:
       labels:
         app: kibana
-      name: kibana
+      name: log-kibana
     spec:
       initContainers:
       - command:
@@ -47,7 +47,7 @@
       volumes:
         - name: kibana-conf
           configMap:
-            name: kibana-configmap
+            name: log-kibana-configmap
             items:
             - key: kibana.yml
               path: kibana.yml
@@ -55,8 +55,8 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: kibana-configmap
-  namespace: {{ .Values.nsPrefix }}-log
+  name: log-kibana-configmap
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/kibana/conf/kibana.yml").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/kibana/conf/kibana.yml").AsConfig . | indent 2 }}
 #{{ end }}
diff --git a/kubernetes/log/templates/log-pv-pvc.yaml b/kubernetes/log/templates/log-pv-pvc.yaml
index a5e5ff7..d0176a5 100644
--- a/kubernetes/log/templates/log-pv-pvc.yaml
+++ b/kubernetes/log/templates/log-pv-pvc.yaml
@@ -2,10 +2,10 @@
 apiVersion: v1
 kind: PersistentVolume
 metadata:
-  name: elasticsearch-db
-  namespace: "{{ .Values.nsPrefix }}-log"
+  name: {{ .Values.nsPrefix }}-elasticsearch-db
+  namespace: "{{ .Values.nsPrefix }}"
   labels:
-    name: elasticsearch-db
+    name: {{ .Values.nsPrefix }}-elasticsearch-db
 spec:
   capacity:
     storage: 2Gi
@@ -19,7 +19,7 @@
 apiVersion: v1
 metadata:
   name: elasticsearch-db
-  namespace: "{{ .Values.nsPrefix }}-log"
+  namespace: "{{ .Values.nsPrefix }}"
 spec:
   accessModes:
     - ReadWriteMany
@@ -28,5 +28,5 @@
       storage: 2Gi
   selector:
     matchLabels:
-      name: elasticsearch-db
+      name: {{ .Values.nsPrefix }}-elasticsearch-db
 #{{ end }}
diff --git a/kubernetes/log/templates/logstash-deployment.yaml b/kubernetes/log/templates/logstash-deployment.yaml
index f99657a..7431081 100644
--- a/kubernetes/log/templates/logstash-deployment.yaml
+++ b/kubernetes/log/templates/logstash-deployment.yaml
@@ -4,8 +4,8 @@
 metadata:
   labels:
     app: logstash
-  name: logstash
-  namespace: {{ .Values.nsPrefix }}-log 
+  name: log-logstash
+  namespace: {{ .Values.nsPrefix }}
 spec:
   selector:
     matchLabels:
@@ -14,7 +14,7 @@
     metadata:
       labels:
         app: logstash
-      name: logstash
+      name: log-logstash
     spec:
       initContainers:
       - command:
@@ -52,13 +52,13 @@
       volumes:
         - name: logstash-conf
           configMap:
-            name: logstash-configmap
+            name: log-logstash-configmap
             items:
             - key: logstash.yml
               path: logstash.yml
         - name: logstash-pipeline
           configMap:
-            name: logstash-configmap
+            name: log-logstash-configmap
             items:
             - key: onap-pipeline.conf
               path: onap-pipeline.conf
@@ -67,9 +67,9 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: logstash-configmap
-  namespace: {{ .Values.nsPrefix }}-log
+  name: log-logstash-configmap
+  namespace: {{ .Values.nsPrefix }}
 data:
-{{ (.Files.Glob "resources/logstash/conf/logstash.yml").AsConfig | indent 2 }}
-{{ (.Files.Glob "resources/logstash/pipeline/onap-pipeline.conf").AsConfig | indent 2 }}
+{{ tpl (.Files.Glob "resources/logstash/conf/logstash.yml").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/logstash/pipeline/onap-pipeline.conf").AsConfig . | indent 2 }}
 #{{ end }}