I want to pass the default key value while reading values file.
{{- range $key, $val := .Values.nodeLabel | default map[string]string{"a":"b"}}}
Values.yaml nodeLabel - a: b
But i am trying to pass default value too.
{{- range $key, $val := .Values.nodeLabel | default "b:c"
error- range cannot iterate over b:c
Please try this:
{{- if .Values.nodeLabel -}}
{{- range $key, $val := .Values.nodeLabel }}
{{ $key }}: {{ $val }}
# {{- end }}
{{ else }}
{{ default "b: c" }}
{{- end -}}
Additional resources: The Chart Best Practices Guide
Hope this help