Search code examples
chartskuberneteskubernetes-helm

How to check if the comma exist in helm charts?


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?


Solution

  • 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: