-
Notifications
You must be signed in to change notification settings - Fork 71
Remove fields that are omitted from applied configurations if there are no other owners #166
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
Remove fields that are omitted from applied configurations if there are no other owners #166
Conversation
|
Could you please specifically pinpoint the limitation of the code in this pull-request? I'm assuming it won't work perfectly across versions? |
|
By the way, while you're looking at this code, we should understand and fix the bug with "complex nested types". |
This goes through Updater.prune which does the required conversions and field set comparisons to handle multi version. I‘ll add more tests to showcase this. |
Complex types should be handled properly. I’ll add test cases for this too. If there are specific bugs I should be aware of please send them my way. |
Awesome yes, I'd be very surprised if this actually works to be honest. Let me think about it for a minute. |
|
@jpbetz Let me know if I can help you write additional tests! |
I spend a while with venn diagrams and couldn't find anything wrong with it. Let me know if you find any problems. |
cf88031 to
ca99bda
Compare
I added field unsetting tests for scalar and complex fields. I also added multi version testing with a converter that does field renames to make sure that prune handles multi version apply correctly. |
c8bbc6d to
e4fddb1
Compare
Awesome, I was looking forward to it, and will definitely look closely at that code! |
e4fddb1 to
1ce4a77
Compare
|
@apelisse I had a look at how defaulting w/r/t this PR.
So it looks like this approach is safe? |
|
As discussed offline, this is probably because we don't run the conversion (and defaulting) if the version is the same in k8s: |
I checked and we don't do defaulting when converting across versions either. I've added some test cases to the design doc showing that we get the behavior we want. I also instrumented a default function and verified that it is not called from within If defaulting happens, we would see "setDefaults_CustomResourceDefinitionSpec called" logged in the above output. Here's the output of |
Co-authored-by: Antoine Pelisse <[email protected]>
5753bf2 to
9f09075
Compare
|
/hold k8s CI has been a bit flaky, but existing k8s unit tests and integration are passing for this change (kubernetes/kubernetes#92661). I'm going to remove this hold once I've added a couple of integration tests in k8s that ensure unsetting fields happens as expected for native types, and they are passing. Feel free to tag this when it looks ready. |
|
Tests added to kubernetes/kubernetes#92661 /hold cancel |
|
This is ready to be merged once reviewers are happy with it. I'd like to get it going today if possible so we can bump k8s to use it for 1.19. |
apelisse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apelisse, jpbetz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Implements the first part of the WG Apply: Unsetting fields design:
Omitting a shared field from an applied configuration:
Omit an exclusively owned field from an applied configuration:
This makes fields consistent with how associative list/map items already behave.
Added a test converter that renames fields (e.g. conversion of v1 to v2 renames "field_v1" to "field_v2") and used it to ensure that fields are unset when the unset is applied at a different version than the previous apply.
cc @apelisse @jennybuckley @lavalamp