Interview Prep/Helm/Helm 3 Architecture & Release Storage

What is the `lookup` function and what are its limits?

AdvancedConceptHelm 3 Architecture & Release Storage
Answer

lookup queries the live cluster during rendering: lookup "v1" "Secret" .Release.Namespace "shop-db" returns the object as a dict, an empty dict if missing, or a list when the name is empty.

{{- $existing := lookup "v1" "Secret" .Release.Namespace "shop-db" }}
password: {{ if $existing }}{{ index $existing.data "password" }}{{ else }}{{ randAlphaNum 24 | b64enc }}{{ end }}

Limits: it returns empty in helm template and --dry-run=client (works with --dry-run=server), it never works under Argo CD (which renders without cluster access), and it needs RBAC get/list on the looked-up kind. Charts that depend on it render differently offline, so keep it to "preserve an existing generated value" cases.

All Helm questions Roadmap: Helm

More on Helm 3 Architecture & Release Storage