How does Helm resolve a chart dependency's tags list, and what wins when condition and tags disagree?
answer
- One switch for several dependencies
- Matched against a top-level map
- Any true tag is enough
- All present and false disables
- The per-chart switch outranks the group
basics
~20 sA dependency's tags list in Chart.yaml is matched against a top-level tags map in the release's values. If any of its tags is true the dependency is enabled; if every tag it names is present and false it is disabled; if none is set it stays enabled. A resolved condition always overrides tags.
solid answer
~50 s`tags` is the group switch to `condition`'s per-chart switch. Each dependency entry may list tag names, and the caller sets a **top-level** `tags:` map in values, so one key can flip several dependencies at once - useful when a chart bundles a database, a cache and a broker that all belong to the same "run it in-cluster" mode. Resolution is deliberately permissive: if any tag the dependency lists is set true, it is enabled; only if every tag it lists is present and set to false is it disabled; if the values mention none of its tags, it keeps its default, which is enabled. When a dependency carries both a `condition` and `tags`, and the condition path resolves to a boolean, the condition decides and the tags are irrelevant. In practice most charts ship conditions only; tags appear in large umbrella charts with several optional components.
code
yaml · 7 lines# values.yaml of the parent chart
tags:
bundled-datastores: false
cache: true
postgresql:
enabled: falsego deeper
Know that a tag is a switch shared by several dependencies and lives in a top-level tags map in values, while a condition switches exactly one dependency.
State the resolution rule precisely - any true tag enables, all-present-and-false disables, unmentioned leaves the default - and that a resolved condition beats tags.
Judge when tags are worth it: a family of components that move together, versus the readability cost of a global switch nobody can trace from values.yaml alone.
Own the convention across a chart estate. Decide whether tag names are a shared vocabulary you govern, and how consumers discover which components a tag actually controls.
### The two switches Helm gives a chart author two ways to make a dependency optional, both declared on the entry in `Chart.yaml`: ```yaml dependencies: - name: postgresql version: 15.3.2 repository: https://charts.example.internal condition: postgresql.enabled tags: - bundled-datastores - name: valkey version: 3.1.4 repository: https://charts.example.internal tags: - bundled-datastores - cache ``` `condition` points at one values path and governs exactly one dependency. `tags` is a list of labels; several dependencies can share a label, so one value flips them together. ### Where the tags map lives Tags are matched against a `tags:` map at the **top level** of the values the release is rendered with - not under the subchart's key, and not inside the subchart's own `values.yaml`: ```yaml tags: bundled-datastores: false cache: true ``` That single map is shared by the whole chart tree, which is the point: it is a set of cross-cutting feature switches rather than per-chart configuration. It also means tag names are effectively a global namespace, so an umbrella chart that pulls in third-party subcharts can find two unrelated charts responding to the same tag name. ### The resolution rule For each dependency, Helm looks at the tags it lists and checks which of them appear in the tags map: - if **any** listed tag is present and true, the dependency is enabled; - if the listed tags that are present are **all** false, the dependency is disabled; - if **none** of its tags appears in the map, the dependency keeps its default state, which is enabled. So tags are OR-ed, and truth wins over falsehood. In the example above, `valkey` lists `bundled-datastores` (false) and `cache` (true): because one of them is true, it is enabled. A candidate who assumes any false tag vetoes the chart gets this backwards, and it is the single most common misunderstanding of the feature. ### Precedence When a dependency has both, and its condition path resolves to a boolean, **the condition wins** - the tag outcome is overwritten. `postgresql` above lists a tag that is false, but if the values also set `postgresql.enabled: true`, the subchart renders. The precedence is one-directional and unconditional in that sense; the only way tags decide a dependency that also has a condition is for the condition to resolve to nothing at all, which happens when the path is absent or holds a non-boolean. That ordering is what makes the pair usable: the tag is the coarse default for a family of components, and the condition is the escape hatch for the one component someone needs to differ. A platform team can ship `tags.bundled-datastores: false` in the production values file and still let one service keep its bundled cache by setting that chart's own condition key. ### When to reach for tags Honestly, rarely. Most real charts use conditions only, because a condition key sits in the same values namespace as the rest of that subchart's configuration, reads naturally in a diff (`postgresql.enabled: false` next to `postgresql.host`), and cannot be flipped by accident from an unrelated part of the values tree. Tags earn their place when one umbrella chart carries a set of components that genuinely move together - a whole in-cluster dependency stack that exists for local development and is switched off everywhere else - and you want one line in the production values file rather than six. The cost is discoverability. A reader of `values.yaml` sees `tags: {bundled-datastores: false}` and cannot tell from that file which dependencies it governs; they have to read `Chart.yaml`, and for a nested tree, several of them. Document the tag names in the chart's README if you use them, and prefer conditions when the switch belongs to exactly one component.
- A dependency lists two tags: one set true, one set false. Does it render?Yes. Tags are OR-ed: a single tag set true is enough to enable the dependency, and a dependency is only disabled when every tag it lists is present in the tags map and set to false. Tags that the values do not mention at all are simply not counted.
- Why do most charts use conditions rather than tags for optional subcharts?A condition key lives beside the rest of that subchart's configuration, so a values diff reads clearly and the switch belongs to one component. A tag is a global name in a shared map: a reader of values.yaml cannot tell which dependencies it governs without opening every Chart.yaml in the tree, and two unrelated subcharts can respond to the same tag.
Tags are a fuse box: one switch cuts power to a whole group of rooms. A condition is the switch on the appliance itself, and it is the one that has the final say.
saying these in an interview costs you the question
- Saying any false tag disables the dependency
- Putting the tags map under the subchart's key
- Claiming tags override a resolved condition
- Treating tags as per-chart configuration rather than a shared switch
- Assuming an unmentioned tag means disabled