Is the Helm lookup() function supported?

In a previous discussion it was noted that Helm kots applications use helm template to install instead of helm install or helm upgrade.

Does this mean that the Helm lookup() function can’t be used?

lookup: lookup is used to look up resource in a running cluster. When used with the helm template command it always returns an empty response.

If so is there any way around it?

Hi @bco That is correct. We have an internal task on the backlog to have this also documented.

A workaround depends on what you’re using the lookup() function for.

The use case is a Helm pre-hook that generates the configuration file for a pod and writes it to a Secret. The Secret is mounted as a file in the pod.

Typically in Helm you would then add an annotation to the Deployment and use lookup() to compute the hash of the Secret, which would then cause a rollout restart when that Secret changes.

One workaround is to compute that hash in code and apply the annotation from the pre-hook code, but it means potentially doing a double rollout restart. I think we will just live with always restarting the service by adding the annotation rollme: {{ uuidv4 }} to the Helm Deployment.

Maybe reloader from stakater could automate this for you?