Search code examples
kuberneteskubernetes-helmgo-templates

how do you quote multiple values with the helm quote function?


for example instead of this:

name: {{ $value.derps | quote }}

can I do something like this?

name: {{ {{ $value.derps }}-{{ $.Release.Namespace }} | quote }}

what is the right syntax for that if its possible. often I want to use multiple values and would like to wrap the final concatenated string with quotes

I also am doing this inside range:

{{- range $key, $value := .Values.SomeConfig }}
    name: {{ $value.derps }}-{{ $.Release.Namespace }} # want to quote this
{{- end }}

Solution

  • These options work but now I'm confused about the utility of the quote function - it seems pretty useless.

    This:

      name: "{{ $value.certName }}-{{ $.Release.Namespace }}"
    

    Is a lot nicer than this

      name: {{ printf "%s-%s" $value.certName - $.Release.Namespace | quote }}
    

    The quote function doesn't make sense to me. I'm not sure why I see it in all the examples.