Search code examples
kuberneteskubernetes-helm

How can we iterate over the files located in the `templates` folder with helm?


I wanted to force the pods to restart if a configmap was modified, so I have added the following annotation in my deployment.yaml:

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

It works perfectly.

I'd like to do it for all the files in my template folder.

Is there a way to do it? I have the impression we cannot iterate over the files located in the templates folder.

Thanks for your help.


Solution

  • To make your pods restart for each deployment, you can add:

          annotations:
              timestamp: {{ now | quote }}