Skip to content

Add test for subchart coalesce null values - #6146

Merged
hickeyma merged 1 commit into
helm:masterfrom
continusec:fix5184regression
Aug 23, 2019
Merged

hickeyma merged 1 commit into
helm:masterfrom
continusec:fix5184regression

Conversation

@aeijdenberg

Copy link
Copy Markdown

Since coalesce can sometimes be called more than once, make sure
that we don't drop keys until right at the end, else they can lose
their meaning (and allow the original value to come through).

More tests would be welcome.

Signed-off-by: Adam Eijdenberg [email protected]

Closes #5184 (at least hopefully improves the situation)

What this PR does / why we need it:

#5184 caused a regress for subchart values. This attempts to fix it.

Special notes for your reviewer:

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 Aug 2, 2019
@aeijdenberg

aeijdenberg commented Aug 2, 2019 •

Copy link
Copy Markdown
Author

(I had to force push with slightly amended commit message a few times until I managed to get the build to pass - it seems there might be some unrelated flaky tests or builds?)

@bacongobbler

bacongobbler commented Aug 6, 2019 •

Copy link
Copy Markdown
Member

Thank you for working on this. We really appreciate it.

@sgillespie would you mind testing to see if this fix works for you?

@thomastaylor312 thomastaylor312 added the bug Categorizes issue or PR as related to a bug. label Aug 6, 2019
@sgillespie

Copy link
Copy Markdown

This does not seem to fix it for me.

Consider a default value in a subchart:

livenessProbe:
  tcpSocket:
    port: 5000

Overridden with:

livenessProbe:
    tcpSocket: null

The result (2.14.2):

livenessProbe:                    
  tcpSocket: null

And this patch:

 livenessProbe:            
   tcpSocket:
     port: 5000

@sgillespie

Copy link
Copy Markdown

FWIW I'm testing with helm template

@aeijdenberg

Copy link
Copy Markdown
Author

@sgillespie is right - this still doesn't fix the demo.zip example in the linked issue.

I've had another look today - sadly I don't think I'm going to be able to fix this easily - and I don't have the capacity available to learn the code base to fully fix it.

The underlying problem so far as I can tell is that chartutil.CoalesceValues() is called many times, and there seems to be an assumption that it's safe to call more than once, passing the previous output as input a 2nd time.

However with the behavior now of removing nil keys, that means that if it's called a second time with a nil key removed, then there's no value value to override the source value and thus it comes back again.

I think the right way to fix is likely to stop removing nil keys at all inside of that function, and instead remove them much closer to wherever the final values files are rendered. And that's the part of the code base I'm not going to have the capacity in the near future to tease apart and figure out.

@sgillespie

Copy link
Copy Markdown

This looks to have been fixed in #6080.

@aeijdenberg

Copy link
Copy Markdown
Author

#6080 does appears to have fixed this, which is great! I've amended this PR to just add the test that I'd already written (which #6080 also fixes), as we can never have enough tests. :)

@aeijdenberg aeijdenberg changed the title Attempt to fix the regression caused by 5184 Add test for subchart coalesce null values Aug 16, 2019

@hickeyma hickeyma 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.

In conjunction with PR #6080 and validation in #6146 (comment), LGTM.

@hickeyma
hickeyma merged commit f8f8b5d into helm:master Aug 23, 2019
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested null values don't remove keys as expected

6 participants