I have a chart that I want to deploy if a certain value is in a list of values. I've tried the following
{{if .Release.Namespace in .Values.Namespaces }}
<chart goes here>
{{ end }}
where the values file used contains the following
Namespaces:
-value1
-value2
but i get an error function "in" not defined
Searching the interwebs I've been unable to find what the proper syntax is for checking if a value exists in a list in helm.
You can use the has
function from the sprig functions library which is used by Helm. Please note however that there's an issue with the documentation of the function (the order of the parameters is wrong). In your case should be something like this:
{{if has .Release.Namespace .Values.Namespaces }}
<chart goes here>
{{ end }}