VOL-2834 Support to deploy multiple adapters
Generate a unique instance id for each replica of the open-onu-adapter and
pass it as a parameter.
Change-Id: I2011860aa9ca85f106704f3f12eecd5c2da1786f
diff --git a/voltha-adapter-openolt/Chart.yaml b/voltha-adapter-openolt/Chart.yaml
index 8ae22e9..ec08fa2 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.0
-appVersion: 2.4.0
+version: 2.4.1
+appVersion: 2.4.1
diff --git a/voltha-adapter-openonu/Chart.yaml b/voltha-adapter-openonu/Chart.yaml
index 5020b43..165d599 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.2
+version: 2.3.3
diff --git a/voltha-adapter-openonu/templates/adapters-openonu.yaml b/voltha-adapter-openonu/templates/adapters-openonu.yaml
index 24e52d8..90c7830 100644
--- a/voltha-adapter-openonu/templates/adapters-openonu.yaml
+++ b/voltha-adapter-openonu/templates/adapters-openonu.yaml
@@ -1,4 +1,3 @@
-{{- if not (and (hasKey .Values "use_openonu_adapter_go") .Values.use_openonu_adapter_go) }}
# Copyright 2019-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,29 +11,40 @@
# 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.
-
+{{- $root := . -}}
+{{- if not (and (hasKey .Values "use_openonu_adapter_go") .Values.use_openonu_adapter_go) }}
+{{- end }}
+{{- $tag := tpl ( tpl .Values.images.adapter_open_onu.tag . ) . }}
+{{- $repository := tpl .Values.images.adapter_open_onu.repository . }}
+{{- $registry := tpl .Values.images.adapter_open_onu.registry . }}
+{{- $pullpolicy := tpl .Values.images.adapter_open_onu.pullPolicy . }}
{{- $log_level := tpl .Values.adapter_open_onu.log_level . | upper }}
+{{- $replica_id := 0 }}
+{{- range $i, $e := until (int .Values.replicas.adapter_open_onu) }}
+{{- $replica_id := add1 $i }}
+
+---
apiVersion: apps/v1
kind: Deployment
metadata:
- name: adapter-open-onu
- namespace: {{ .Release.Namespace }}
- {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "openonu_deployment_labels") }}
+ name: adapter-open-onu-{{ $replica_id }}
+ namespace: {{ $root.Release.Namespace }}
+ {{- if or (hasKey $root.Values "extra_deployment_labels") (hasKey $root.Values "openonu_deployment_labels") }}
labels:
- {{- if hasKey .Values "extra_deployment_labels" }}
- {{- range $key, $val := .Values.extra_deployment_labels }}
+ {{- if hasKey $root.Values "extra_deployment_labels" }}
+ {{- range $key, $val := $root.Values.extra_deployment_labels }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
- {{- if hasKey .Values "openonu_deployment_labels" }}
- {{- range $key, $val := .Values.openonu_deployment_labels }}
+ {{- if hasKey $root.Values "openonu_deployment_labels" }}
+ {{- range $key, $val := $root.Values.openonu_deployment_labels }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
{{- end }}
spec:
- replicas: {{ .Values.replicas.adapter_open_onu }}
+ replicas: 1
selector:
matchLabels:
app: adapter-open-onu
@@ -43,18 +53,18 @@
labels:
app: adapter-open-onu
app.kubernetes.io/name: "adapter-open-onu"
- app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
+ app.kubernetes.io/version: {{ quote $root.Chart.AppVersion }}
app.kubernetes.io/component: "adapter"
app.kubernetes.io/part-of: "voltha"
- app.kubernetes.io/managed-by: {{ quote .Release.Service }}
- helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
- {{- if hasKey .Values "extra_pod_labels" }}
- {{- range $key, $val := .Values.extra_pod_labels }}
+ app.kubernetes.io/managed-by: {{ quote $root.Release.Service }}
+ helm.sh/chart: "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}"
+ {{- if hasKey $root.Values "extra_pod_labels" }}
+ {{- range $key, $val := $root.Values.extra_pod_labels }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
- {{- if hasKey .Values "openonu_pod_labels" }}
- {{- range $key, $val := .Values.openonu_pod_labels }}
+ {{- if hasKey $root.Values "openonu_pod_labels" }}
+ {{- range $key, $val := $root.Values.openonu_pod_labels }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
@@ -63,23 +73,26 @@
spec:
containers:
- name: adapter-open-onu
- image: '{{ tpl .Values.images.adapter_open_onu.registry . }}{{ tpl .Values.images.adapter_open_onu.repository . }}:{{ tpl ( tpl .Values.images.adapter_open_onu.tag . ) . }}'
- imagePullPolicy: {{ tpl .Values.images.adapter_open_onu.pullPolicy . }}
+ image: '{{ $registry }}{{ $repository }}:{{ $tag }}'
+ imagePullPolicy: {{ $pullpolicy }}
env:
- name: COMPONENT_NAME
valueFrom:
fieldRef:
fieldPath: metadata.labels['app.kubernetes.io/name']
+ image: '{{ $registry }}{{ $repository }}:{{ $tag }}'
args:
- "/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 }}"
+ - "--kafka_adapter={{ $root.Values.services.kafka.adapter.service }}:{{ $root.Values.services.kafka.adapter.port }}"
+ - "--kafka_cluster={{ $root.Values.services.kafka.cluster.service }}:{{ $root.Values.services.kafka.cluster.port }}"
- "--core_topic=rwcore"
- "--name=brcm_openomci_onu"
- "--backend=etcd"
- - "--etcd={{ .Values.services.etcd.service }}:{{ .Values.services.etcd.port }}"
+ - "--etcd={{ $root.Values.services.etcd.service }}:{{ $root.Values.services.etcd.port }}"
- "--probe=:8080"
- "--log_level={{ $log_level }}"
+ - "--totalReplicas={{ $root.Values.replicas.adapter_open_onu }}"
+ - "--currentReplica={{ $replica_id }}"
readinessProbe:
httpGet:
path: /readz
@@ -92,4 +105,5 @@
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
+
{{- end }}
diff --git a/voltha-adapter-openonu/values.yaml b/voltha-adapter-openonu/values.yaml
index e2acb98..0edccb2 100644
--- a/voltha-adapter-openonu/values.yaml
+++ b/voltha-adapter-openonu/values.yaml
@@ -49,7 +49,7 @@
adapter_open_onu:
registry: '{{ .Values.defaults.image_registry }}'
repository: '{{ .Values.defaults.image_org }}voltha-openonu-adapter'
- tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}2.3.6{{- end }}{{- else }}2.3.6{{- end }}'
+ tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}2.4.0{{- end }}{{- else }}2.4.0{{- end }}'
pullPolicy: '{{ .Values.defaults.image_pullPolicy }}'
adapter_open_onu_go:
repository: '{{ .Values.defaults.image_org }}voltha-openonu-adapter-go'
diff --git a/voltha/Chart.yaml b/voltha/Chart.yaml
index d40c7b2..13fe6b0 100644
--- a/voltha/Chart.yaml
+++ b/voltha/Chart.yaml
@@ -17,8 +17,8 @@
description: A Helm chart for Voltha based on K8S resources in Voltha project
icon: https://guide.opencord.org/logos/cord.svg
-version: 2.4.0-dev0
+version: 2.4.0
# app version applies to multiple components with potentially different
# container image versions
-appVersion: 2.3
+appVersion: 2.4
diff --git a/voltha/values.yaml b/voltha/values.yaml
index 8bc8421..b979076 100644
--- a/voltha/values.yaml
+++ b/voltha/values.yaml
@@ -103,5 +103,5 @@
rw_core:
registry: '{{ .Values.defaults.image_registry }}'
repository: '{{ .Values.defaults.image_org }}voltha-rw-core'
- tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}2.3.5{{- end }}{{- else }}2.3.5{{- end }}'
+ tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}2.4.0{{- end }}{{- else }}2.4.0{{- end }}'
pullPolicy: '{{ .Values.defaults.image_pullPolicy }}'