Reputation: 948
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.
Upvotes: 17
Views: 35779
Reputation: 571
You can use the has
function from the sprig functions library which is used by Helm. In your case should be something like this:
{{if has .Release.Namespace .Values.Namespaces }}
<chart goes here>
{{ end }}
Upvotes: 31