I have the following data in my function $newdict
modules:
module1:
enabled: true
module2:
enabled: false
module3:
enabled: true, etc
What is need to do is : check if module1 enabled, then set enabled for module2 as well. What I tried in _helpers.tpl file:
{{- range $key, $value := $newdict -}}
{{ if and (eq $key "module1") (eq "enabled" "true") }}
{{ $_ := set $newdict $key "module2" (eq "enabled" "true") }}
{{ end }}
{{ end }}
{{ toYaml $newdict }}
helm lint doesn't show any errors, but the changes are not reflected in $newdict
This thing is needed for deployment.yaml to deploy init container:
initContainers:
{{- $mycustom := (include "myfunction" . ) | fromYaml}}
{{- range $key, $value := $mycustom }}
{{- if $value.enabled }}
- name: init-{{ $key }}-myinit
So, in the end, I need to deploy init container "module2" only if "module1" is also deployed