Repository navigation
fix: stringify non-string map keys in values files - #2899
Merged
yxxhero merged 1 commit intoNov 15, 2026
Merged
Conversation
YAML keys such as 404 or true decode to int or bool, and CastKeysToStrings rejected them with 'unexpected type of key in map', so a values file Helm accepts could not be loaded as environment values. Convert such keys with fmt.Sprintf like DeepCopyMap already does. Signed-off-by: Lucas Barros <[email protected]>
lbarrosby
requested review from
aditmeno,
itscaro,
mumoshu,
xiaomudk,
yxxhero and
zhaque44
as code owners
November 14, 2026 09:39
yxxhero
approved these changes
Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
maputil.CastKeysToStringsreturns an error for any map key that is not a string. YAML keys such as404:ortrue:decode toint/bool, so an environment values file like this:fails to load:
Helm accepts the same file and turns the keys into strings. Helmfile itself already does that in
maputil.DeepCopyMap, whose doc comment says it normalisesmap[any]anykeys "matching CastKeysToStrings", butCastKeysToStringserrors out instead.This makes
CastKeysToStringsstringify non-string keys withfmt.Sprintf("%v", k), the same waydeepCopyValuedoes. The function is used for environment values, environment secrets, release values andfromYaml.Tests:
TestMapUtil_NonStringKeysinpkg/maputildecodes the YAML above (plus atrue:key) with yaml v3 and checks the result. It fails without the change with the error above.TestEnvValsLoad_NonStringKeysinpkg/stateloadstestdata/values.10.yamlthroughLoadEnvironmentValues.go test ./pkg/maputil/andgo test ./pkg/state/ -run TestEnvValsLoadpass, andgofmt -lis clean.