Skip to content

Fix subchart value deletion - #6080

Merged
thomastaylor312 merged 1 commit into
helm:masterfrom
deitmerit:fix/subchart-value-deletion
Aug 14, 2019
Merged

thomastaylor312 merged 1 commit into
helm:masterfrom
deitmerit:fix/subchart-value-deletion

Conversation

@deitmerit

Copy link
Copy Markdown

What this PR does / why we need it:
Overwriting a subchart's default value with nil in the parent chart's values.yaml should delete the value (see https://github.com/helm/helm/blob/master/docs/chart_template_guide/values_files.md#deleting-a-default-key).

closes #3804

Special notes for your reviewer:
This is my first PR for the helm project, so please let me know if it is missing anything.

The problem seemed to be that when called with a non-nil chart.Config argument, the chartutil.CoalesceValues function called coalesceDeps twice (once via coalesce and once directly).
The first call removed the subchart's value as expected, but the second call then re-introduced the value, because the nil value from the parent's values is gone.
Roughly like this:
coalesceDeps(values: {subchart.value=nil}, subchart values: {value=foo}) => result: {}
coalesceDeps(values: {}, subchart values: {value=foo}) => result: {subchart.value=foo})

I added a very minimalistic unit test and re-used the moby chart and one of its subcharts for this. Not sure if this should be expanded to include more use-cases.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 25, 2019
@deitmerit

Copy link
Copy Markdown
Author

The unit test that fails in circleci is green on my machine :(

@bacongobbler

Copy link
Copy Markdown
Member

Circle has been having some performance degradation issues as of late. Rebooting the job should let the tests pass. I've rebooted the job.

@thomastaylor312 thomastaylor312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. I did some manual validation as well to make sure the normal value deletion still worked as well for non-subchart values

@thomastaylor312 thomastaylor312 added this to the 2.15.0 milestone Aug 14, 2019
@thomastaylor312 thomastaylor312 added the Needs v3 backport Label PRs for v4/main, which are still applicable to v3 so need a separate backport PR label Aug 14, 2019
@thomastaylor312
thomastaylor312 merged commit f4a5598 into helm:master Aug 14, 2019
@bacongobbler

Copy link
Copy Markdown
Member

Removing the v3 port label. This was fixed in Helm 3 during a larger refactor via #5781.

@bacongobbler bacongobbler added the v3 port complete For completed v2->v3 ports label Sep 24, 2019
@hickeyma hickeyma removed the Needs v3 backport Label PRs for v4/main, which are still applicable to v3 so need a separate backport PR label Sep 24, 2019
@arnaud-deprez

Copy link
Copy Markdown

Dear,

According to my comment #5184 (comment), it still does not work with v2.15.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. v3 port complete For completed v2->v3 ports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete sub-chart value key from parent-chart

6 participants