Skip to content

bugfix: Fix subchart values not overriding with null when -f is used - #13513

Closed
jsvk wants to merge 2 commits into
helm:mainfrom
jsvk:test
Closed

jsvk wants to merge 2 commits into
helm:mainfrom
jsvk:test

Conversation

@jsvk

@jsvk jsvk commented Dec 7, 2024 •

Copy link
Copy Markdown

What this PR does / why we need it:

closes #12488 (bug was also noted here: #12162 (comment))
related: #12879

This is another attempt at fixing issue #12488.

Upgrading Argo CD from v2.8.21 → v2.9.22 upgrades helm from v3.12.1 → v3.13.2, which is a version in which this bug was introduced.

This caused applications to break because of the difference in rendering behavior for the charts, and so the upgrade was rolled back.

The test reproduces one of the major issues that caused us to roll back, and the change makes the test pass.

Special notes for your reviewer:

While this does fix what is (at least from what I can tell) a bug, this also changes the behavior of the original ToRenderValuesWithSchemaValidation to render with MergeValues instead of CoalesceValues which does change the rendered output, at least back to what it was in v3.12.1. This seems like the original behavior before my PR may have been unintentionally introduced in #12162 but ideally @mattfarina if you could let me know if i'm missing something that would be fantastic

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@pull-request-size pull-request-size Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 7, 2024
@jsvk jsvk changed the title bugfix: Override subchart values with null when -f is used #12879 bugfix: Override subchart values with null when -f is used Dec 7, 2024
@jsvk
jsvk force-pushed the test branch 4 times, most recently from c1eb73e to c65fee4 Compare December 7, 2024 02:00
@jsvk
jsvk marked this pull request as ready for review December 7, 2024 16:11
@jsvk jsvk changed the title bugfix: Override subchart values with null when -f is used bugfix: Fix subchart values not overriding with null when -f is used Dec 7, 2024

@robertsirc robertsirc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robertsirc robertsirc added the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Feb 5, 2025
Signed-off-by: jsvk <[email protected]>

@mattfarina mattfarina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testing does not show a change in behavior to make sure it's preserved. The same golden output as a different situation is used. How can we tell when this is working and when not?

Comment thread cmd/helm/install_test.go
name: "install with schema file, extra values from yaml, with errors",
cmd: "install schema testdata/testcharts/chart-with-schema -f testdata/testcharts/chart-with-schema/extra-values.yaml",
wantError: true,
golden: "output/schema-negative.txt",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This golden file is only used here. If it's not going to be used anymore, the schema-negative.txt file should be removed.

Why is the golden file being removed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies that looks like a temporary change i made during testing/development. I've closed this PR for now but if it's needed in the future, I will fix the above before reopening.

Comment thread cmd/helm/template_test.go
// Same as above, but ensures this still works when '-f' is used: https://github.com/helm/helm/issues/12488
name: "ensure nil/null values pass to subcharts delete values when '-f' is used",
cmd: fmt.Sprintf("template '%s' -f %s/values.yaml", deletevalchart, deletevalchart),
golden: "output/issue-9027.txt",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this golden file the same as the test before it but the input is different? Should this have a different output and a different golden file?

@jsvk jsvk Apr 18, 2025 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this one it's intentional - the idea is to assert the -f doesn't change the behavior of how values.yaml is applied between these two scenarios. The other implication is that the new issue-9027.txt file is the new desired output for both scenarios.

admittedly it's confusing because for the test above this one, the values.yaml is implicit, and for this test it's using the same values.yaml file but just with an -f, which is what triggers the different behavior i wanted to address in this PR.

i could have

  • maybe copied the issue-9027.txt golden file and named it more appropriately (issue-12488.txt)
  • updated both files to reflect the new (desired) behavior
  • clarified that the only difference from the previous test is the use of -f to pass the (same) values.yaml, and that the output should be the same

given that an alternate PR (#12879) has been merged to try and address this, I've closed this PR. if we end up needing this PR in the future, I will make those adjustments before reopening

@jsvk

jsvk commented Apr 18, 2025

Copy link
Copy Markdown
Author

closing since #12879 was merged, thanks all!

@jsvk jsvk closed this Apr 18, 2025
@scottrigby scottrigby removed the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

subchart keys can not be removed by parent chart in v3.13.* when --values (-f) flag is used

4 participants