[VOL-3906] Dynamically generating controller list
Change-Id: Iadff3fc9e44549b42f6cff5ce49a3db692afa5be
diff --git a/voltha-infra/Chart.yaml b/voltha-infra/Chart.yaml
index ab7cc7c..488d976 100644
--- a/voltha-infra/Chart.yaml
+++ b/voltha-infra/Chart.yaml
@@ -29,7 +29,7 @@
name: voltha-infra
appVersion: "2.8-dev"
-version: 0.2.4
+version: 0.2.5
dependencies:
- name: onos-classic
@@ -38,7 +38,7 @@
condition: onos-classic.enabled
- name: bbsim-sadis-server
repository: https://charts.opencord.org
- version: 0.1.1
+ version: 0.2.0
condition: bbsim-sadis-server.enabled
- name: etcd
repository: https://charts.bitnami.com/bitnami
diff --git a/voltha-stack/Chart.yaml b/voltha-stack/Chart.yaml
index b4d175a..9860942 100644
--- a/voltha-stack/Chart.yaml
+++ b/voltha-stack/Chart.yaml
@@ -28,7 +28,7 @@
name: voltha-stack
appVersion: "2.8-dev"
-version: 0.2.4
+version: 0.2.5
dependencies:
- name: voltha
diff --git a/voltha-stack/values.yaml b/voltha-stack/values.yaml
index 74015e1..ca2ec1b 100644
--- a/voltha-stack/values.yaml
+++ b/voltha-stack/values.yaml
@@ -25,6 +25,9 @@
voltha:
enabled: true
+ onos_classic:
+ onosOfPort: 6653
+ replicas: 1
ingress:
enabled: false
enableVirtualHosts: false
@@ -43,9 +46,6 @@
address: "{{ .Values.global.voltha_infra_name }}-etcd.{{ .Values.global.voltha_infra_namespace }}.svc:2379"
tracing_agent:
address: "{{ .Values.global.voltha_infra_name }}-voltha-tracing-jaeger-agent.{{ .Values.global.voltha_infra_namespace }}.svc:6831"
- controller:
- # TODO need to customize for multiple instances
- - address: "{{ .Values.global.voltha_infra_name }}-onos-classic-hs.{{ .Values.global.voltha_infra_namespace }}.svc:6653"
voltha-adapter-openonu:
enabled: true
diff --git a/voltha/Chart.yaml b/voltha/Chart.yaml
index b3a9a71..9719139 100644
--- a/voltha/Chart.yaml
+++ b/voltha/Chart.yaml
@@ -14,7 +14,7 @@
---
apiVersion: "v1"
name: "voltha"
-version: "2.9.4"
+version: "2.9.5"
description: "A Helm chart for Voltha based on K8S resources in Voltha project"
keywords:
- "onf"
diff --git a/voltha/templates/ofagent-deploy.yaml b/voltha/templates/ofagent-deploy.yaml
index b091224..8f77ae3 100644
--- a/voltha/templates/ofagent-deploy.yaml
+++ b/voltha/templates/ofagent-deploy.yaml
@@ -11,7 +11,17 @@
# 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.
-{{- $log_level := tpl .Values.ofagent.log_level . | upper }}
+{{- $log_level := tpl .Values.ofagent.log_level . | upper -}}
+{{- $onosReplicas := default 1 .Values.onos_classic.replicas -}}
+{{- $onosOfPort := default 6653 .Values.onos_classic.onosOfPort -}}
+{{- $infraName := default "voltha-infra" .Values.global.voltha_infra_name -}}
+{{- $infraNamespaces := default "infra" .Values.global.voltha_infra_namespace -}}
+{{- $controllers := dict "controllers" (list) -}}
+{{- range $i, $e := until ($onosReplicas | int) -}}
+ {{- $port := add $onosOfPort $i -}}
+ {{- $current := printf "%s-onos-classic-%d.%s-onos-classic-hs.%s.svc:%d" $infraName $i $infraName $infraNamespaces $port -}}
+ {{- $controllers := (mustAppend $controllers.controllers $current) | set $controllers "controllers" -}}
+{{- end -}}
---
apiVersion: apps/v1
kind: Deployment
@@ -81,6 +91,9 @@
value: {{ .Values.global.kv_store_data_prefix }}
args:
- "/app/ofagent"
+ {{- range $controllers.controllers }}
+ - "--controller={{ . }}"
+ {{- end }}
{{- range .Values.services.controller }}
- "--controller={{ tpl .address $ }}"
{{- end }}
diff --git a/voltha/values.yaml b/voltha/values.yaml
index b185c16..19facea 100644
--- a/voltha/values.yaml
+++ b/voltha/values.yaml
@@ -59,8 +59,10 @@
address: jaeger-agent:6831
# Define the list of controllers to connect to
- controller:
- - address: onos-openflow:6653
+ # NOTE this is needed only in case you need to connect to an external ONOS,
+ # if you want to connect to an ONOS installed via voltha-infra please refer to the onos_classic field in this config
+ controller: []
+ # - address: onos-openflow:6653
# Expose the golang pprof webserver, if enabled
profiler:
@@ -118,3 +120,8 @@
paths:
- "/voltha.VolthaService/"
tls: []
+
+# ofAgent needs to connect to multiple instances of ONOS.
+onos_classic:
+ onosOfPort: 6653
+ replicas: 1