How to check if the comma exist in helm charts?

9/13/2019

I'd like to use some code like below to describe a comma is the substring of the string.

{{- if contains '\,' .alias }}

But it reports the error in the line when using helm lint

 invalid syntax

How to write it correctly?

-- che yang
charts
kubernetes
kubernetes-helm

1 Answer

9/16/2019

Thanks to community user Bimal.

It can be applied like:

{{- if contains "," .Values.xxx.name }}
  some_data: {{ .Values.xxx.name }}
{{- end }}

For further reference please follow String Functions:

-- Hanx
Source: StackOverflow