mirror of https://github.com/helm/helm
When processDependencyEnabled recurses into sub-charts (path != ''),
the coalesced parent values already contain all sub-chart defaults via
coalesceDeps. Calling CoalesceValues again with the full parent values
causes spurious 'Not a table' warnings when a parent-level key (e.g.,
tolerations:{}) has a different type than the sub-chart's default for
the same key name (e.g., tolerations:[]).
Skip the redundant CoalesceValues call in recursive invocations and
use the already-coalesced values directly.
Fixes #11251
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Arnav Nagzirkar <113314200+arnavnagzirkar@users.noreply.github.com>
pull/32197/head
parent
609e1ca72c
commit
174b599be8
@ -0,0 +1,26 @@
|
||||
# Agent Result
|
||||
|
||||
## Root Cause
|
||||
|
||||
In `processDependencyEnabled(c *chart.Chart, v map[string]any, path string)`, recursive calls (when `path != ""`) called `util.CoalesceValues(c, v)` where `v` was the fully coalesced parent values. These parent values contain top-level keys (e.g., `tolerations: {}`) that are unrelated to the sub-chart being processed. When `coalesceValues` iterated over sub-chart defaults (e.g., `tolerations: []`), it found the parent-level `tolerations: {}` entry in `v` as the destination. Since a map cannot be merged with a slice, the warning `warning: skipped value for <path>tolerations: Not a table.` was emitted spuriously.
|
||||
|
||||
The second `CoalesceValues` call in recursive invocations is redundant: when `ProcessDependencies` calls `processDependencyEnabled(parent, userVals, "")`, the initial `CoalesceValues(parent, userVals)` internally runs `coalesceDeps` which already merges all sub-chart defaults recursively. The subsequent `CoalesceValues(sub-chart, full_parent_cvals)` in each recursive call re-processes sub-chart defaults against the wrong scope.
|
||||
|
||||
## Change Made
|
||||
|
||||
- `pkg/chart/v2/util/dependencies.go` - `processDependencyEnabled`: When `path != ""` (recursive call), skip `util.CoalesceValues` and set `cvals = v` directly. The parent values are already fully coalesced and scoped correctly for tag/condition evaluation.
|
||||
- `internal/chart/v3/util/dependencies.go` - `processDependencyEnabled`: Identical change for the v3 chart format.
|
||||
|
||||
## Testing
|
||||
|
||||
Added regression test `TestProcessDependencyEnabledNoSpuriousWarnings` to both:
|
||||
- `pkg/chart/v2/util/dependencies_test.go`
|
||||
- `internal/chart/v3/util/dependencies_test.go`
|
||||
|
||||
The test creates a 3-level chart hierarchy (parent -> subchart -> subsubchart) where `parent.Values["tolerations"]` is a map and `subchart.Values["tolerations"]` is a slice. It redirects standard log output via `log.SetOutput` and verifies no "Not a table" warning is emitted after the fix.
|
||||
|
||||
Go is not available in this environment so tests could not be executed directly.
|
||||
|
||||
## Lint
|
||||
|
||||
Golangci-lint is not available in this environment. The changes are minimal - only flow control logic was modified (added `if/else` block replacing a direct `CoalesceValues` call). No new functions, types, or external dependencies were introduced. All imports used in the modified files were already present.
|
||||
Loading…
Reference in new issue