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

8/29/2019

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 }}
-- red888
go-templates
kubernetes
kubernetes-helm

2 Answers

8/29/2019

these options work but now im confused about the utility of the quote function seems pretty useless?

This:

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

Is a lot nicer than this

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

Quote function doesnt make sense to me. not sure why I see it in all the examples

-- red888
Source: StackOverflow

8/29/2019

Did you try something like this?

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

or

name: "{{ $value.derps }}-{{ $.Release.Namespace }}"
-- Bimal
Source: StackOverflow