Helm flow control: if, with, and range in chart templates
Answer: Helm's template language provides the following control structures.
The main actions
Control structures, called actions in template parlance, give you the ability to control the flow of a template's generation.
if and else are for creating conditional blocks.
with is used to specify a scope.
range provides a for each-style loop.
Where the rest lives
The others are covered in the Named Templates section later in this guide.
Let's add a simple conditional to our ConfigMap.
A pipeline is evaluated as false for the empty or zero-like values listed on the page.
The first control structure the page looks at is for conditionally including blocks.
See also
Claims
- id: C1 claim: Helm's template language provides the following control structures. source: S1 evidence: "Helm's template language provides the following control structures"
- id: C2 claim: range provides a for each-style loop. source: S1 evidence: "range , which provides a \"for each\"-style loop"
- id: C3 claim: with is used to specify a scope. source: S1 evidence: "with to specify a scope"
- id: C4 claim: The others are covered in the Named Templates section later in this guide. source: S2 evidence: "The others are covered in the \"Named Templates\" section later in this guide."
Sources
- [S1] Flow Control. The Helm Authors. https://helm.sh/docs/chart_template_guide/control_structures/ . License: MIT. Accessed 2026-11-24.
- [S2] Flow Control (source). The Helm Authors. https://raw.githubusercontent.com/helm/helm-www/main/docs/chart_template_guide/control_structures.md . License: MIT. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Helm Authors, Flow Control; The Helm Authors, Flow Control (source). MIT (https://raw.githubusercontent.com/helm/helm-www/main/LICENSE). Copyright The Helm Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Helm Authors, Flow Control; The Helm Authors, Flow Control (source). MIT (https://raw.githubusercontent.com/helm/helm-www/main/LICENSE). Copyright The Helm Authors.
Cite this
iinventedlight. 2026. "Helm flow control: if, with, and range in chart templates." iinventedlight Library, iil:note:yg2yk158, version of 2026-11-24. https://iinventedlight.com/library/notes/helm-control-structures/. License: CC-BY-4.0.
@misc{iil_note_yg2yk158,
author = {{iinventedlight}},
title = {{Helm flow control: if, with, and range in chart templates}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/helm-control-structures/},
note = {Permanent ID iil:note:yg2yk158. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- helm-control-structures.schema.json (schema; CC-BY-4.0)
- helm-control-structures.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/helm-control-structures.md.