Skip to content

docs: Correct chart name validation rules to match helm lint (DNS-1123 subdomain)#2161

Draft
promptless-for-oss wants to merge 1 commit into
helm:mainfrom
Promptless:promptless/fix-chart-name-validation-rules
Draft

docs: Correct chart name validation rules to match helm lint (DNS-1123 subdomain)#2161
promptless-for-oss wants to merge 1 commit into
helm:mainfrom
Promptless:promptless/fix-chart-name-validation-rules

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Updates the "Chart Names" best-practices section (v3 and v4 docs) to match the validation helm lint now enforces via chartutil.ValidateMetadataName: dots are allowed (e.g. my.chart), the length limit is 253 characters, and names follow DNS-1123 subdomain (not label) rules. The previous docs incorrectly listed dots as invalid and stated a 63-character limit.

Trigger Events


Tip: Sort by Shortest Review in the Dashboard to find quick wins ⚡

helm lint now validates chart names via chartutil.ValidateMetadataName,
which permits dots and allows up to 253 characters (DNS-1123 subdomain),
not the DNS-1123 label rules (no dots, 63 chars) previously documented.

Ref: helm/helm#32278
Signed-off-by: promptless[bot] <promptless[bot]@users.noreply.github.com>
Chart names must follow DNS-1123 label conventions: only lowercase letters,
numbers, and dashes are allowed, names must start and end with a lowercase
letter or number, and names cannot exceed 63 characters:
Chart names are used as a prefix for the resources a chart creates, so they must

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.

PR #32278 makes helm lint call chartutil.ValidateMetadataName on the chart name. Its error message ("use lowercase letters, digits, hyphens, and dots only (e.g. my-chart, my.chart)") and added test cases (valid: my.chart; invalid: MyInvalidChart, my_chart, -my-chart, my-chart-, my chart, ../badchartname) confirmed that dots are now valid, which is why I changed the doc from "Names with dots ... invalid" to listing spaces and path separators as the invalid cases.

Source: helm/helm#32278

letter or number, and names cannot exceed 63 characters:
Chart names are used as a prefix for the resources a chart creates, so they must
be valid Kubernetes resource names. Names must follow DNS-1123 subdomain
conventions: only lowercase letters, numbers, dashes, and dots are allowed;

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.

ValidateMetadataName in validate_name.go enforces the regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ with maxMetadataNameLen = 253. This is the source of the corrected "DNS-1123 subdomain" wording, the per-dot-segment start/end rule, and the 253-character limit replacing the previous 63-character claim.

Source: https://github.com/helm/helm/blob/main/pkg/chart/v2/util/validate_name.go

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