helm double quote annotations value

4/18/2020

I am trying to quote my annotation values. I am trying like this

annotations:
  {{- range $key, $value := .Values.ingress.annotations }}
     {{ $key }}: {{ printf "%s" $value | quote }}
  {{- end }}

and this

annotations:
  {{- range $key, $value := .Values.ingress.annotations }}
     {{ $key }}: "{{ $value }}"
  {{- end }}

this is my values.yaml

annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: false

but it is not working. Even if I double quote the annotation value in values.yaml helm is removing the quote. Can somebody tell me how can I get helm with double quote values in annotation?

I am using Helm version 3.

-- user3847894
kubernetes
kubernetes-helm
kubernetes-ingress
nginx-ingress

1 Answer

4/18/2020

You could try this:

annotations:
  {{- range $key, $value := .Values.ingress.annotations }}
     {{ $key }}: {{ $value | quote }}
  {{- end }}
-- hoque
Source: StackOverflow