From a6037c62fa18a7f58865c73931e47b9e8aba22e1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 12 Sep 2021 20:28:22 +0200 Subject: [PATCH] fix: ensure annotationLists and labelLists don't get processed for disabled objects (#971) --- charts/library/common/Chart.yaml | 2 +- .../library/common/templates/lib/chart/_values.tpl | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index b66fdc1a931..d72ed15a24c 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: common sources: null type: library -version: 7.0.4 +version: 7.0.5 diff --git a/charts/library/common/templates/lib/chart/_values.tpl b/charts/library/common/templates/lib/chart/_values.tpl index 7f935b00396..85ec36767aa 100644 --- a/charts/library/common/templates/lib/chart/_values.tpl +++ b/charts/library/common/templates/lib/chart/_values.tpl @@ -65,6 +65,7 @@ {{/* merge persistenceAnnotationsList with persistenceAnnotations */}} {{- range $index, $item := .Values.persistence }} + {{- if $item.enabled }} {{- $persistenceAnnotationsDict := dict }} {{- range $item.annotationsList }} {{- $_ := set $persistenceAnnotationsDict .name .value }} @@ -73,10 +74,12 @@ {{- $persistenceanno := merge $tmp $persistenceAnnotationsDict }} {{- $_ := set $item "annotations" (deepCopy $persistenceanno) -}} {{- end }} + {{- end }} {{/* merge persistenceLabelsList with persistenceLabels */}} {{- range $index, $item := .Values.persistence }} + {{- if $item.enabled }} {{- $persistenceLabelsDict := dict }} {{- range $item.labelsList }} {{- $_ := set $persistenceLabelsDict .name .value }} @@ -85,6 +88,7 @@ {{- $persistencelab := merge $tmp $persistenceLabelsDict }} {{- $_ := set $item "labels" (deepCopy $persistencelab) -}} {{- end }} + {{- end }} {{/* merge ingressList with ingress */}} @@ -102,6 +106,7 @@ {{/* merge ingressAnnotationsList with ingressAnnotations */}} {{- range $index, $item := .Values.ingress }} + {{- if $item.enabled }} {{- $ingressAnnotationsDict := dict }} {{- range $item.annotationsList }} {{- $_ := set $ingressAnnotationsDict .name .value }} @@ -110,10 +115,12 @@ {{- $ingressanno := merge $tmp $ingressAnnotationsDict }} {{- $_ := set $item "annotations" (deepCopy $ingressanno) -}} {{- end }} + {{- end }} {{/* merge ingressLabelsList with ingressLabels */}} {{- range $index, $item := .Values.ingress }} + {{- if $item.enabled }} {{- $ingressLabelsDict := dict }} {{- range $item.labelsList }} {{- $_ := set $ingressLabelsDict .name .value }} @@ -122,6 +129,7 @@ {{- $ingresslab := merge $tmp $ingressLabelsDict }} {{- $_ := set $item "labels" (deepCopy $ingresslab) -}} {{- end }} + {{- end }} {{/* Enable privileged securitycontext when deviceList is used */}} {{- if .Values.securityContext.privileged }} @@ -157,19 +165,23 @@ {{/* merge serviceList with service */}} {{- $portsDict := dict }} {{- range $index, $item := .Values.serviceList -}} + {{- if $item.enabled }} {{- $name := ( printf "list-%s" ( $index | toString ) ) }} {{- if $item.name }} {{- $name = $item.name }} {{- end }} {{- $_ := set $portsDict $name $item }} {{- end }} + {{- end }} {{- $srv := merge .Values.service $portsDict }} {{- $_ := set .Values "service" (deepCopy $srv) -}} {{/* merge portsList with ports */}} {{- range $index, $item := .Values.service -}} + {{- if $item.enabled }} {{- $portsDict := dict }} {{- range $index2, $item2 := $item.portsList -}} + {{- if $item2.enabled }} {{- $name := ( printf "list-%s" ( $index2 | toString ) ) }} {{- if $item2.name }} {{- $name = $item2.name }} @@ -180,5 +192,7 @@ {{- $ports := merge $tmp $portsDict }} {{- $_ := set $item "ports" (deepCopy $ports) -}} {{- end }} + {{- end }} + {{- end }} {{- end -}}