fix(recipe): handle null override in mergeValues to delete keys#458
Merged
Conversation
mergeValues did not handle nil (YAML null) values, so overlays using emptyDir: null to remove the base Prometheus emptyDir storage config would store the nil value instead of deleting the key. This produced emptyDir: null in the generated Helm values, which the Prometheus CRD rejected at deploy time. Add nil-check that deletes the key from dst when src value is nil, aligning with RFC 7396 (JSON Merge Patch) semantics. Signed-off-by: Jonathan Tong <[email protected]> Signed-off-by: Jont828 <[email protected]>
Collaborator
|
/ok to test 60d190b |
mchmarny
approved these changes
Mar 31, 2026
Contributor
|
This pull request has been automatically locked since it has been closed for 90 days with no further activity. Please open a new pull request for related changes. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
mergeValuesdid not handlenil(YAMLnull) values — overlays settingemptyDir: nullto remove the base Prometheus emptyDir storage config stored the nil value instead of deleting the keyemptyDir: nullin generated Helm values, which the Prometheus CRD rejected at deploy time with:spec.storage.emptyDir: Invalid value: "null"dstwhensrcvalue isnil, aligning with RFC 7396 (JSON Merge Patch) semantics used by Helm and KustomizeAffects all cloud provider overlays (AKS, EKS, GKE) that override Prometheus storage from emptyDir to PVC-backed storage.
Test plan
"null override deletes key"table-driven test case covering the PrometheusemptyDir → volumeClaimTemplatescenariogo test -race ./pkg/recipe/... -run TestMergeValuespassesmake qualifypasses in CIemptyDir: null