From b4456f81f76cceb850ddf13f5e0c053616ab4cbd Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 2 Oct 2020 23:55:04 +0500 Subject: [PATCH] Fix scope issue inside loop --- charts/ix-chart/2009.0.1/templates/_helpers.tpl | 2 +- charts/ix-chart/2009.0.1/templates/deployment.yaml | 7 ++----- .../2009.0.1/templates/external-interfaces.yaml.py | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/charts/ix-chart/2009.0.1/templates/_helpers.tpl b/charts/ix-chart/2009.0.1/templates/_helpers.tpl index 2f783e56ae7..8b7a70394a5 100644 --- a/charts/ix-chart/2009.0.1/templates/_helpers.tpl +++ b/charts/ix-chart/2009.0.1/templates/_helpers.tpl @@ -66,5 +66,5 @@ Create the name of the service account to use Name for external interfaces to be added to chart */}} {{- define "externalInterfaceName" -}} -{{- printf "%s" .Release.Name }} +{{- printf "ix-%s" $.Release.Name }} {{- end }} diff --git a/charts/ix-chart/2009.0.1/templates/deployment.yaml b/charts/ix-chart/2009.0.1/templates/deployment.yaml index ec23c8b0f49..33bdba12bbb 100644 --- a/charts/ix-chart/2009.0.1/templates/deployment.yaml +++ b/charts/ix-chart/2009.0.1/templates/deployment.yaml @@ -14,11 +14,8 @@ spec: {{- include "ix-chart.selectorLabels" . | nindent 8 }} annotations: rollme: {{ randAlphaNum 5 | quote }} - {{- if .Values.externalInterfaces }} - k8s.v1.cni.cncf.io/networks: - {{- range $index, $iface := .Values.externalInterfaces }} - - {{ include "externalInterfaceName" . }}-{{ $index }} - {{- end }} + {{- if .Values.externalInterfacesConfigurationNames }} + k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.externalInterfacesConfigurationNames }} {{- end }} spec: containers: diff --git a/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py b/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py index 439f0890981..6776e0385af 100644 --- a/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py +++ b/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py @@ -1,9 +1,9 @@ -{{- range $index, $iface := .Values.externalInterfaces }} +{{- range $index, $iface := .Values.externalInterfacesConfiguration }} +--- apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: - name: {{ include "externalInterfaceName" . }}-{{ $index }} + name: ix-{{ $.Release.Name }}-{{ $index }} spec: config: '{{ $iface }}' ----------------------------------------------------------- {{- end }}