[VOL-3091] configurable kafka topic

Make core-topic and adapter topics configurable in voltha-helm-charts
This is required to run multiple voltha stacks in a k8s deployment.

Also, read the kv_store_data_prefix via environment variable.
https://gerrit.opencord.org/#/c/19001/

Change-Id: I8fabda3ce70f1379f735796e6711f4282e57008a
diff --git a/voltha-adapter-openolt/Chart.yaml b/voltha-adapter-openolt/Chart.yaml
index 86e972e..c44c179 100644
--- a/voltha-adapter-openolt/Chart.yaml
+++ b/voltha-adapter-openolt/Chart.yaml
@@ -17,5 +17,5 @@
 description: A Helm chart for Voltha OpenOLT Adapter
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 2.4.2
+version: 2.4.3
 appVersion: 2.4.1
diff --git a/voltha-adapter-openolt/templates/adapters-openolt.yaml b/voltha-adapter-openolt/templates/adapters-openolt.yaml
index 6151c4b..aa3d6b8 100644
--- a/voltha-adapter-openolt/templates/adapters-openolt.yaml
+++ b/voltha-adapter-openolt/templates/adapters-openolt.yaml
@@ -49,7 +49,6 @@
     {{- end }}
   {{- end }}
 spec:
-  replicas: {{ .Values.replicas.adapter_open_olt }}
   selector:
     matchLabels:
       app: adapter-open-olt
@@ -80,21 +79,26 @@
         - name: adapter-open-olt
           image: '{{ tpl .Values.images.adapter_open_olt.registry . }}{{ tpl .Values.images.adapter_open_olt.repository . }}:{{ tpl ( tpl .Values.images.adapter_open_olt.tag . ) . }}'
           imagePullPolicy: {{ tpl .Values.images.adapter_open_olt.pullPolicy . }}
-          env:
+          env: 
             - name: COMPONENT_NAME
               valueFrom:
                 fieldRef:
                   fieldPath: metadata.labels['app.kubernetes.io/name']
+            - name: KV_STORE_DATAPATH_PREFIX
+              value: {{ .Values.defaults.kv_store_data_prefix }}
           args:
             - "/app/openolt"
             - "--kafka_adapter_host={{ .Values.services.kafka.adapter.service }}"
             - "--kafka_adapter_port={{ .Values.services.kafka.adapter.port }}"
             - "--kafka_cluster_host={{ .Values.services.kafka.cluster.service }}"
             - "--kafka_cluster_port={{ .Values.services.kafka.cluster.port }}"
-            - "--core_topic=rwcore"
+            - "--core_topic={{ .Values.defaults.topics.core_topic }}"
+            - "--adapter_topic={{ .Values.defaults.topics.adapter_open_olt_topic }}"
             - "--kv_store_host={{ .Values.services.etcd.service }}"
             - "--kv_store_port={{ .Values.services.etcd.port }}"
             - "--log_level={{ $log_level }}"
+            - "--current_replica={{ .Values.replicas.current_replica }}"
+            - "--total_replica={{ .Values.replicas.total_replica }}"
             - "--probe_port=8080"
           livenessProbe:
             httpGet:
diff --git a/voltha-adapter-openolt/values.yaml b/voltha-adapter-openolt/values.yaml
index 7c8fce3..4090902 100644
--- a/voltha-adapter-openolt/values.yaml
+++ b/voltha-adapter-openolt/values.yaml
@@ -20,6 +20,14 @@
   image_tag: ~
   image_org: "voltha/"
   image_pullPolicy: "Always"
+  topics:
+    core_topic: "rwcore"
+    adapter_open_olt_topic: "openolt"
+  
+  # Define prefix path for etcd
+  # If you're running multiple voltha stacks the this value 
+  # should be unique across the stacks.
+  kv_store_data_prefix: "service/voltha"
 
 # Define connectivity to required services
 services:
@@ -42,7 +50,8 @@
 
 # Define the recplica count for everything
 replicas:
-  adapter_open_olt: 1
+  current_replica: 1
+  total_replica: 1
 
 adapter_open_olt:
   log_level: '{{ .Values.defaults.log_level }}'
diff --git a/voltha-adapter-openonu/Chart.yaml b/voltha-adapter-openonu/Chart.yaml
index d16d84d..7c85984 100644
--- a/voltha-adapter-openonu/Chart.yaml
+++ b/voltha-adapter-openonu/Chart.yaml
@@ -17,4 +17,4 @@
 description: A Helm chart for Voltha OpenONU Adapter
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 2.3.6
+version: 2.3.7
\ No newline at end of file
diff --git a/voltha-adapter-openonu/templates/adapters-openonu.yaml b/voltha-adapter-openonu/templates/adapters-openonu.yaml
index feb5666..f7ffa94 100644
--- a/voltha-adapter-openonu/templates/adapters-openonu.yaml
+++ b/voltha-adapter-openonu/templates/adapters-openonu.yaml
@@ -71,8 +71,9 @@
           - "REPLICA_ID=$(echo $VOLTHA_POD_NAME | grep -o '.$') && REPLICA_ID=$((REPLICA_ID + 1)) && echo $REPLICA_ID && python /voltha/adapters/brcm_openomci_onu/main.py
               --kafka_adapter={{ .Values.services.kafka.adapter.service }}:{{ .Values.services.kafka.adapter.port }}
               --kafka_cluster={{ .Values.services.kafka.cluster.service }}:{{ .Values.services.kafka.cluster.port }}
-              --core_topic=rwcore
-              --name=brcm_openomci_onu
+              --core_topic={{ .Values.defaults.topics.core_topic }}
+              --adapter_topic={{ .Values.defaults.topics.adapter_open_olt_topic }}
+              --name={{ .Values.defaults.topics.adapter_open_onu_topic }}
               --backend=etcd
               --etcd={{ .Values.services.etcd.service }}:{{ .Values.services.etcd.port }}
               --probe=:8080
diff --git a/voltha-adapter-openonu/values.yaml b/voltha-adapter-openonu/values.yaml
index 0edccb2..0097619 100644
--- a/voltha-adapter-openonu/values.yaml
+++ b/voltha-adapter-openonu/values.yaml
@@ -22,6 +22,10 @@
   image_tag: ~
   image_org: "voltha/"
   image_pullPolicy: "Always"
+  topics:
+    core_topic: "rwcore"
+    adapter_open_onu_topic: "brcm_openomci_onu"
+    adapter_open_olt_topic: "openolt"
 
 # Define connectivity to required services
 services:
diff --git a/voltha/Chart.yaml b/voltha/Chart.yaml
index d721cf0..293aee9 100644
--- a/voltha/Chart.yaml
+++ b/voltha/Chart.yaml
@@ -14,7 +14,7 @@
 # limitations under the License.
 apiVersion: "v1"
 name: "voltha"
-version: "2.4.8"
+version: "2.4.9"
 description: "A Helm chart for Voltha based on K8S resources in Voltha project"
 keywords:
   - "onf"
diff --git a/voltha/templates/core-deploy.yaml b/voltha/templates/core-deploy.yaml
index 1a805ec..6ce8406 100644
--- a/voltha/templates/core-deploy.yaml
+++ b/voltha/templates/core-deploy.yaml
@@ -74,6 +74,8 @@
               valueFrom:
                 fieldRef:
                   fieldPath: metadata.labels['app.kubernetes.io/name']
+            - name: KV_STORE_DATAPATH_PREFIX
+              value: {{ .Values.defaults.kv_store_data_prefix }}
           args:
             - "/app/rw_core"
             - "-kv_store_type=etcd"
@@ -86,9 +88,7 @@
             - "-kafka_adapter_port={{ .Values.services.kafka.adapter.port }}"
             - "-kafka_cluster_host={{ .Values.services.kafka.cluster.service }}"
             - "-kafka_cluster_port={{ .Values.services.kafka.cluster.port }}"
-            - "-rw_core_topic=rwcore"
-            - "-core_pair_topic=core-pair-1"
-            - "-kv_store_data_prefix=service/voltha"
+            - "-rw_core_topic={{ .Values.defaults.topics.core_topic }}"
             - "-in_competing_mode=false"
             - "-core_timeout=10s"
             - "-timeout_long_request=10s"
diff --git a/voltha/values.yaml b/voltha/values.yaml
index 52b72a7..cb2b9e1 100644
--- a/voltha/values.yaml
+++ b/voltha/values.yaml
@@ -24,6 +24,13 @@
   image_pullPolicy: "Always"
   rw_core:
     timeout: "8000"
+  topics:
+    core_topic: "rwcore"
+    
+  # Define prefix path for etcd
+  # If you're running multiple voltha stacks the this value 
+  # should be unique across the stacks.
+  kv_store_data_prefix: "service/voltha"
 
 securityContext:
   enabled: true