Templating in Helm Values Files
Issue
Helm does not support templating within values files, even though it can significantly improve the readability and maintainability of charts in some cases.
For example, default values might depend on other values or chart metadata.
Solution
- A helper template is included in each chart template to expand the values (unfortunately, Helm does not support pre-render hooks to run a template first).
- The template recursively applies the
tpl
function to values until no further changes occur - The number of iterations is limited. If the limit is exceeded, templating fails to prevent infinite loops caused by circular references.