Inside a
rangeloop in Helm template, the context refers to the current item in the loop iteration. This means that when you use.inside arangeloop, you’re accessing the current item in the loop.
$.refers to the top-level context that was passed into the template, and you can use it to access properties that are outside of the currentrangeloop.If you want to access the
.Valuesvariable inside a named template included inside arangeloop, you can pass it as an argument to the template.{{- define “my-template” }}
{{- $myVar := $.Values.myVar }}
{{- printf “myVar: %s” $myVar }}
{{- end }}{{- range .items }}
From ChatGPT and validated/edited by myself
{{- include “my-template” . (dict “Values” $.Values) }}
{{- end }}