6

A third-party chart which I use a dependency allows extra annotations to be passed in from values file. However the annotation I want to pass in is checksum/config

values.yaml

mychart:
    annotations:
       checksum/config: "{{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}"

But whatever passed from the values files is rendered as string. Is there a working way to pass in checsum/config from values.yaml?

Sam Alex
  • 123
  • 1
  • 7

2 Answers2

0

It passed as a String because you added double quotes "" outside the {{}}... You just need to remove the double quotes.

0

You can do it like this:

values.yaml

podAnnotations:
  checksum/config: '{{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}'

templates/deployment.yaml

spec:
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- tpl (toYaml .) $ | nindent 8 }}
      {{- end }}

Result:

spec:
  template:
    metadata:
      annotations:
        checksum/config: 'd464b243d16631e438f2944569aa390c7d4932d8f36597163fba35d4bd2bddd5'

Hope it can help :)

benCat
  • 124
  • 3
  • 7