[VOL-3906] Dynamically generating controller list
Change-Id: Iadff3fc9e44549b42f6cff5ce49a3db692afa5be
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