Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested null value overrides #5185

Merged
merged 1 commit into from Jun 3, 2019
Merged

Conversation

aeijdenberg
Copy link

Closes #5184

What this PR does / why we need it:

This PR adds tests for setting nested values to null and ensure such values are actually deleted.

Special notes for your reviewer:

I've split this into 4 commits. They do the following:

  1. Adds some code to the tests to make it easier to add nested null values tests.
  2. Adds tests that fails.
  3. Does a fairly minimal fix - this is enough to make the tests pass.
  4. The last commit touches a bit more code, and attempts to simplify the coalescence more broadly by consolidating on to a single codepath, and being a bit more careful about which maps are mutated. Tests continue to pass - but I'm a little less confident about the full impact of this commit.

If applicable:

  • this PR contains unit tests

@helm-bot helm-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 18, 2019
@cdenneen
Copy link

@aeijdenberg can you fix this by adding metadata to the integration tests? Really want to get this fix in place.

@aeijdenberg aeijdenberg force-pushed the fixnestednullcoalesce branch 2 times, most recently from 6c7105b to 01cd6a0 Compare March 27, 2019 04:40
@aeijdenberg
Copy link
Author

@cdenneen - I've found the missing metadata, added it, and removed the nil check. Let me know if you'd like that added back in.

(oh, and also re-based on latest master)

@cdenneen
Copy link

I’m okay with nil being valid “null” setting but that’s just me

@cdenneen
Copy link

@aeijdenberg can you add label bug and awaiting review

@cdenneen
Copy link

cdenneen commented Apr 20, 2019

@aeijdenberg can you please add those labels?

@bacongobbler
Copy link
Member

bacongobbler commented Apr 21, 2019

Only admins can attach labels. I've done the needful.

@bacongobbler bacongobbler added awaiting review bug Categorizes issue or PR as related to a bug. labels Apr 21, 2019
@cdenneen
Copy link

Thanks @bacongobbler

@scottrigby
Copy link
Member

scottrigby commented Apr 23, 2019

Hi I just saw this from #5184 👋 I'm late to the party

@cdenneen Quick reply to #5185 (comment): the reason I added these 5 lines in the test initially is that null, Null, NULL, and ~ are all valid when parsed, but different from empty string "". I think it's fine that these are already checked on these lines and don't need to be re-checked in the deeply nested test added by this PR 👍

@aeijdenberg re point 4 in the PR description, I'm also not fully sure about other possible impacts of this (second to last) commit: e69e888. @bacongobbler I'd like another set of eyes on that. But, it does fix the 🐛 (the updated tests are great, and I also manually tested with a few different scenarios I'm aware of from community helm/charts) - everything seems to work 💯

pkg/chartutil/values.go Outdated Show resolved Hide resolved
@aeijdenberg
Copy link
Author

Hi all, sorry to go quiet on this PR. Am back on deck now - let me know if any changes are desired.

scottrigby added a commit to codecademy-engineering/helm-charts that referenced this pull request May 4, 2019
- External port can always be handled by port-forwarding or Ingress
- Allows us to more easily move probes to values (use case: override probe for a
  sidekiq rails container)
- Temporarily comment out probes in order to use other handlers. Follow issue at
  helm/helm#5185

Signed-off-by: Scott Rigby <scott@r6by.com>
@scottrigby
Copy link
Member

I resolved my last comment. This LGTM 👍 but would still like another set of eyes on the reorganizing commit I mentioned here #5185 (comment)

@thomastaylor312
Copy link
Contributor

Hey @aeijdenberg so that refactor commit looks pretty good, but I want to review it a little more in depth with @scottrigby to make sure it doesn't affect other things. Would you be willing to pop that commit off of this PR and open it as a separate PR? It would allow us to merge this fix and address the refactor in another PR.

Thanks for going through the refactoring effort with this code. We really appreciate it!

@helm-bot helm-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 31, 2019
- Add ability to test for nested non-existent keys
- Add test cases for nested null values
- Minimalist fix for nested null key test cases
- Add missing metadata to integration test

Signed-off-by: Adam Eijdenberg <adam.eijdenberg@digital.gov.au>
@aeijdenberg
Copy link
Author

@thomastaylor312 - done. I've rebased on latest master, squashed the commits (excluding the refactor), and have opened #5821 for the refactoring.

Copy link
Member

@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

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

Thanks for splitting this. Lgtm

Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

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

Ok, sorry for the delay. I was talking with some of the other maintainers to make sure that deleting a key wouldn't create any side effects. This LGTM. Thanks for the good work!

@scottrigby scottrigby added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed awaiting review labels Jun 3, 2019
@scottrigby scottrigby merged commit 02ea889 into helm:master Jun 3, 2019
@aeijdenberg aeijdenberg deleted the fixnestednullcoalesce branch June 4, 2019 01:50
@scottrigby scottrigby modified the milestones: 2.15.0, 2.14.2 Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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
7 participants