VOL-3183 - chart best practice updates

- separated each resource into its own template
- added security context for runas
- added namespace to metadata
- added release name as part of selector

Change-Id: I2a63d099f6bbc4b0615addceccfbd04cff09ef4f
diff --git a/voltha/Chart.yaml b/voltha/Chart.yaml
index 8f0eeb8..a449d4d 100644
--- a/voltha/Chart.yaml
+++ b/voltha/Chart.yaml
@@ -1,4 +1,3 @@
----
 # Copyright 2019-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,15 +11,18 @@
 # 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"
 name: "voltha"
-version: "2.4.10"
+version: "2.4.11"
 description: "A Helm chart for Voltha based on K8S resources in Voltha project"
 keywords:
   - "onf"
   - "voltha"
+  - "core"
+  - "ofagent"
 home: "https://www.opennetworking.org/voltha"
-icon: "https://guide.opencord.org/logos/cord.svg"
+icon: "https://guide.opencord.org/logos/voltha.svg"
 sources:
   - "https://github.com/opencord/voltha-go"
   - "https://github.com/opencord/ofagent-go"
diff --git a/voltha/templates/api-svc.yaml b/voltha/templates/api-svc.yaml
index 04f8dea..1804875 100644
--- a/voltha/templates/api-svc.yaml
+++ b/voltha/templates/api-svc.yaml
@@ -16,6 +16,7 @@
 kind: Service
 metadata:
   name: voltha-api
+  namespace: "{{ .Release.Namespace }}"
 spec:
   ports:
     - name: grpc
@@ -23,3 +24,4 @@
       targetPort: 50057
   selector:
     app: rw-core
+    release: "{{ .Release.Name }}"
diff --git a/voltha/templates/core-deploy.yaml b/voltha/templates/core-deploy.yaml
index 3dfb922..699afce 100644
--- a/voltha/templates/core-deploy.yaml
+++ b/voltha/templates/core-deploy.yaml
@@ -17,6 +17,7 @@
 kind: Deployment
 metadata:
   name: voltha-rw-core
+  namespace: {{ .Release.Namespace }}
   {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "rw_core_deployment_labels") }}
   labels:
     {{- if hasKey .Values "extra_deployment_labels" }}
@@ -32,10 +33,16 @@
   {{- end }}
 spec:
   replicas: 1
+  selector:
+    matchLabels:
+      app: rw-core
+      release: {{ .Release.Name }}
   template:
     metadata:
+      namespace: {{ .Release.Namespace }}
       labels:
         app: rw-core
+        release: {{ .Release.Name }}
         app.kubernetes.io/name: "read-write-core"
         app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
         app.kubernetes.io/component: "core"
diff --git a/voltha/templates/core-profile-svc.yaml b/voltha/templates/core-profile-svc.yaml
index 967d4ab..49f16da 100644
--- a/voltha/templates/core-profile-svc.yaml
+++ b/voltha/templates/core-profile-svc.yaml
@@ -17,6 +17,7 @@
 kind: Service
 metadata:
   name: voltha-rw-core-profiler
+  namespace: {{ .Release.Namespace }}
 spec:
   clusterIP: None
   ports:
@@ -25,4 +26,5 @@
       targetPort: 6060
   selector:
     app: rw-core
+    release: {{ .Release.Name }}
 {{- end }}
diff --git a/voltha/templates/ofagent-deploy.yaml b/voltha/templates/ofagent-deploy.yaml
index e45e957..2c38a5f 100644
--- a/voltha/templates/ofagent-deploy.yaml
+++ b/voltha/templates/ofagent-deploy.yaml
@@ -17,6 +17,7 @@
 kind: Deployment
 metadata:
   name: voltha-ofagent
+  namespace: {{ .Release.Namespace }}
   {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "ofagent_deployment_labels") }}
   labels:
     {{- if hasKey .Values "extra_deployment_labels" }}
@@ -34,8 +35,10 @@
   replicas: {{ .Values.replicas.ofagent }}
   template:
     metadata:
+      namespace: {{ .Release.Namespace }}
       labels:
         app: ofagent
+        release: {{ .Release.Name }}
         app.kubernetes.io/name: "open-flow-agent"
         app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
         app.kubernetes.io/component: "integration"
@@ -74,8 +77,8 @@
         {{- range .Values.services.controller }}
         - "--controller={{ .service }}:{{ .port }}"
         {{- end }}
-        - "--voltha=voltha-api.{{ .Release.Namespace }}.svc.cluster.local:55555"
-        - "--kv_store_host=voltha-etcd-cluster-client.{{ .Release.Namespace }}.svc.cluster.local"
+        - "--voltha=voltha-api.{{ .Release.Namespace }}.svc:55555"
+        - "--kv_store_host=etcd.{{ .Release.Namespace }}.svc"
         - "--kv_store_port=2379"
         - "--kv_store_type=etcd"
         - "--kv_store_request_timeout=60s"
diff --git a/voltha/templates/ofagent-profile-svc.yaml b/voltha/templates/ofagent-profile-svc.yaml
index 6a18864..1e77a08 100644
--- a/voltha/templates/ofagent-profile-svc.yaml
+++ b/voltha/templates/ofagent-profile-svc.yaml
@@ -17,6 +17,7 @@
 kind: Service
 metadata:
   name: voltha-of-agent-profiler
+  namespace: {{ .Release.Namespace }}
 spec:
   clusterIP: None
   ports:
@@ -25,4 +26,5 @@
       targetPort: 6060
   selector:
     app: ofagent
+    release: {{ .Release.Name }}
 {{- end }}
diff --git a/voltha/values.yaml b/voltha/values.yaml
index cba138c..6964d80 100644
--- a/voltha/values.yaml
+++ b/voltha/values.yaml
@@ -1,4 +1,3 @@
----
 # Copyright 2019-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +11,7 @@
 # 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.
+---
 
 # Default Values
 # The following are the default values used for every container in the
@@ -32,6 +32,7 @@
   # should be unique across the stacks.
   kv_store_data_prefix: "service/voltha"
 
+# Default security context under which the containers run
 securityContext:
   enabled: true
   fsGroup: 1001