'Helm, add checksum annotation from values

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?



Solution 1:[1]

This is a current limitation of Helm (see #2492, 6876).

The standard way to render values from values.yaml as a template is to use the tpl function. Since you mentioned that the chart is third-party, this may not be a viable solution.

Instead, you will need to pass the value for the annotations with the checksum to Helm. Some deployment tools (like Terraform, Helmfile, and Skaffold) can be used to automate passing dynamic values to a Helm chart.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rpatel