Deep copy daemonset_yaml cross loop
In templates/utils/_daemonset_overrides.tpl, $context.Values.__daemonset_yaml is used cross the loop. It is not deep copied in each round of loop. It means that the property set in the previous round of loop will still exist in current loop. This is not expected. This patch is to make a deep copy in each round of loop. Change-Id: I4e610e4acf67d92257f9d254546ec0b5b31609fe
This commit is contained in:
parent
6b8f0065cb
commit
2df03d3a32
@ -21,7 +21,6 @@ limitations under the License.
|
||||
{{- $configmap_name := index . 3 }}
|
||||
{{- $context := index . 4 }}
|
||||
{{- $_ := unset $context ".Files" }}
|
||||
{{- $_ := set $context.Values "__daemonset_yaml" $daemonset_yaml }}
|
||||
{{- $daemonset_root_name := printf (print $context.Chart.Name "_" $daemonset) }}
|
||||
{{- $_ := set $context.Values "__daemonset_list" list }}
|
||||
{{- $_ := set $context.Values "__default" dict }}
|
||||
@ -194,12 +193,13 @@ limitations under the License.
|
||||
{{- $list_aggregate := append $context.Values.__daemonset_list $context.Values.__default }}
|
||||
{{- $_ := set $context.Values "__daemonset_list" $list_aggregate }}
|
||||
|
||||
{{- $_ := set $context.Values "__last_configmap_name" $configmap_name }}
|
||||
{{- range $current_dict := $context.Values.__daemonset_list }}
|
||||
|
||||
{{- $context_novalues := omit $context "Values" }}
|
||||
{{- $merged_dict := merge $current_dict.nodeData $context_novalues }}
|
||||
{{- $_ := set $current_dict "nodeData" $merged_dict }}
|
||||
{{/* Deep copy original daemonset_yaml */}}
|
||||
{{- $_ := set $context.Values "__daemonset_yaml" ($daemonset_yaml | toYaml | fromYaml) }}
|
||||
|
||||
{{/* name needs to be a DNS-1123 compliant name. Ensure lower case */}}
|
||||
{{- $name_format1 := printf (print $daemonset_root_name "-" $current_dict.name) | lower }}
|
||||
@ -235,7 +235,7 @@ limitations under the License.
|
||||
{{- range $current_volume := $context.Values.__daemonset_yaml.spec.template.spec.volumes }}
|
||||
{{- $_ := set $context.Values "__volume" $current_volume }}
|
||||
{{- if hasKey $context.Values.__volume "secret" }}
|
||||
{{- if eq $context.Values.__volume.secret.secretName $context.Values.__last_configmap_name }}
|
||||
{{- if eq $context.Values.__volume.secret.secretName $configmap_name }}
|
||||
{{- $_ := set $context.Values.__volume.secret "secretName" $current_dict.dns_1123_name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@ -272,6 +272,5 @@ limitations under the License.
|
||||
{{/* generate daemonset yaml */}}
|
||||
---
|
||||
{{ $context.Values.__daemonset_yaml | toYaml }}
|
||||
{{- $_ := set $context.Values "__last_configmap_name" $current_dict.dns_1123_name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user