Set ChartDir only for directory-based charts to enable $ref resolution in
JSON schemas. Archived charts (.tgz) are loaded into memory without filesystem
extraction, so $ref resolution is not supported for them.
This fixes the original issue where `helm template .` and `helm install .`
failed to validate schemas with relative $ref references.
Fixes#31260
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
Schema validation with $ref cross-file references only works when charts
are available as directories on the filesystem. The install, template, and
upgrade commands may work with archived charts (.tgz) that are loaded
directly into memory without filesystem extraction.
This change limits ChartDir setting to the lint command only. The lint
command already extracts archived charts to temporary directories before
validation, so $ref resolution works for both directory and archived charts
when linting.
For install/template/upgrade commands:
- Main schema validation continues to work
- Charts without $ref validate successfully
- Charts with $ref will fail .. maybe we could add a warning about $ref not being supported in these commands?
Changes:
- Remove ChartDir assignment from install and upgrade commands
- Update schema validation to use synthetic path when chartDir is empty
- Add test for linting archived chart with $ref
- Remove install/template/upgrade tests for $ref (not supported)
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
Extends JSON schema validation to support relative $ref imports
across helm lint, install, template, and upgrade commands.
Addresses George's review comments:
- Pass chartDir directly instead of deriving from valuesPath
- Create new functions instead of changing public API signatures
- Use absolute file paths for proper URL-based $ref resolution
Implementation:
- Added ValidateAgainstSchemaWithPath to resolve $ref using
absolute file paths instead of root-relative URLs
- Thread chartDir through Install/Upgrade structs and all
validation functions
- Updated both v2 (public) and v3 (internal) lint rules
Fixes relative $ref resolution when running commands like:
helm lint ../sample-chart
helm install release ../sample-chart
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
* feat(create): add hidden --chart-api-version flag
Add --chart-api-version flag to helm create command to allow selecting
chart API version (v2 or v3) when creating a new chart.
- Default is v2 (existing behavior unchanged)
- v3 uses internal/chart/v3 scaffold generator
- Invalid versions return clear error message
- Works with --starter flag
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* Add HELM_EXPERIMENTAL_CHART_V3 feature gate to create command
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* make chartv3 private and use loader to load the chart
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* Hide chart-api-version flag until chart v3 is officially released
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* Conditionally hide the --chart-api-version flag if chart v3 is not enabled
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* Add internal gates package for internal feature gates
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
* Add doc for internal/gates package
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
---------
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
Improve the description to explain the three usage scenarios:
- --wait alone defaults to 'watcher' strategy
- --wait=<value> uses the specified strategy
- flag omitted defaults to 'hookOnly'
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
The --api-versions flag was undocumented in the template command's
help text. This adds usage documentation and examples showing both
comma-separated and multiple flag usage patterns.
Fixes#13198
Signed-off-by: majiayu000 <1835304752@qq.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.com>