Skip to content

docs: Clarify how alias interacts with dependency conditions and tags#2183

Draft
promptless-for-oss wants to merge 1 commit into
helm:mainfrom
Promptless:promptless/document-alias-condition-interaction
Draft

docs: Clarify how alias interacts with dependency conditions and tags#2183
promptless-for-oss wants to merge 1 commit into
helm:mainfrom
Promptless:promptless/document-alias-condition-interaction

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Documents the interaction between a dependency alias and the condition/tags fields in the chart dependencies guide. Adds a note to the "Alias field in dependencies" section and a bullet to the "Tags and Condition Resolution" list explaining that when a dependency uses an alias, its condition path and enabling values in the top parent's values must be keyed by the alias name (not the original chart name); that a chart reached through an aliased dependency chain accumulates the alias name at each level of the values path; and that tags are matched by their declared labels and are unaffected by aliasing. Applied identically to docs/topics/charts.mdx (v4/next) and versioned_docs/version-3/topics/charts.md (released v3). Claims verified against helm/helm dependency-processing source.

Trigger Events


Tip: Enable auto-create PR in your Configuration to review suggestions directly in GitHub 🤖

Document that when a chart dependency uses an alias, its condition path and
enabling values in the top parent's values must be keyed by the alias name,
that nested aliased chains accumulate the alias at each level, and that tags
are matched by their labels rather than the alias name. Applied to both the
version-3 and next (v4) charts guide.

Signed-off-by: promptless[bot] <promptless[bot]@users.noreply.github.com>
Comment thread docs/topics/charts.mdx
The manual way of achieving this is by copy/pasting the same chart in the
`charts/` directory multiple times with different names.

When a dependency uses an `alias`, the alias becomes the dependency's name for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifies that an alias becomes the dependency's name for condition evaluation. In processDependencyEnabled, if req.Alias != "" { req.Name = req.Alias } (lines 165-166) runs before processDependencyConditions (defined line 40), which resolves cvals.PathValue(cpath + c) (line 47) against the user-defined condition path. Confirmed by testdata/subpop/Chart.yaml where the dependency name=subchart2, alias=subchart2alias uses condition: subchart2alias.enabled.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L165-L166

Comment thread docs/topics/charts.mdx
enabled: true
```

For a chart reached through an aliased dependency chain, the values path

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifies that the values path accumulates the alias name at each level of an aliased dependency chain. Recursion builds subpath := path + t.Metadata.Name + "." (line 205); getAliasDependency sets the copied chart's out.Metadata.Name = dep.Alias, so the metadata name equals the alias, producing paths like outer-alias.inner-alias.enabled.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L205

Comment thread docs/topics/charts.mdx

For a chart reached through an aliased dependency chain, the values path
accumulates the alias name at each level (for example,
`outer-alias.inner-alias.enabled`). Tags are not affected by an alias: they are

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifies that tags are not affected by an alias. processDependencyTags (defined line 64) reads the "tags" values table via cvals.Table("tags") (line 69) and matches each dependency's r.Tags labels against vt[k]; the dependency name (r.Name) is used only in a non-bool warning log message, never for tag matching.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L64-L69

The manual way of achieving this is by copy/pasting the same chart in the
`charts/` directory multiple times with different names.

When a dependency uses an `alias`, the alias becomes the dependency's name for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirror of docs/topics/charts.mdx alias-condition note. Verifies alias becomes the dependency's name for condition evaluation: if req.Alias != "" { req.Name = req.Alias } (lines 165-166) runs before processDependencyConditions (line 40); condition path resolved via cvals.PathValue(cpath + c) (line 47). Confirmed by testdata/subpop/Chart.yaml (name=subchart2, alias=subchart2alias, condition: subchart2alias.enabled).

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L165-L166

enabled: true
```

For a chart reached through an aliased dependency chain, the values path

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirror of docs/topics/charts.mdx. Verifies values path accumulates the alias at each level: recursion builds subpath := path + t.Metadata.Name + "." (line 205) and getAliasDependency sets out.Metadata.Name = dep.Alias. Also verifies tags unaffected by alias via processDependencyTags reading cvals.Table("tags").

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L205

Comment thread docs/topics/charts.mdx
- Tags and conditions values must be set in the top parent's values.
- The `tags:` key in values must be a top level key. Globals and nested `tags:`
tables are not currently supported.
- When a dependency uses an `alias`, its `condition` path is keyed by the alias

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifies the Tags and Condition Resolution bullet: an aliased dependency's condition path is keyed by the alias (req.Name = req.Alias at lines 165-166 before processDependencyConditions), and tags are matched by r.Tags labels against the "tags" table (processDependencyTags, lines 64-69), not by chart/alias name.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L165-L166

- Tags and conditions values must be set in the top parent's values.
- The `tags:` key in values must be a top level key. Globals and nested `tags:`
tables are not currently supported.
- When a dependency uses an `alias`, its `condition` path is keyed by the alias

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirror of docs/topics/charts.mdx Tags and Condition Resolution bullet. Verifies aliased dependency's condition path is keyed by the alias (req.Name = req.Alias, lines 165-166, before processDependencyConditions) and tags are matched by r.Tags labels against the "tags" table (processDependencyTags, lines 64-69), not by chart/alias name.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/dependencies.go#L165-L166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant