-
Notifications
You must be signed in to change notification settings - Fork 905
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
Clear XR field managers when upgrading to claim SSA #5555
Conversation
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
https://github.com/kubernetes/client-go/blob/v0.30.0/util/csaupgrade/upgrade.go#L165 This appears to be necessary to ensure the patch is rejected if we've derived our patch from a stale version of the object. Signed-off-by: Nic Cope <nicc@rk0n.org>
thanks, LGTM. |
This comment from @ravilr about also needing similar clearing of field managers in |
I'd rather @ravilr or I tackle that in a separate PR, rather than expand the scope of this one. |
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.
just a minor comment, other than that, LGTM! thanks @negz!
// | ||
// Step 5: Eventually the XR reconciler updates a field (e.g. spec.resourceRefs) | ||
// and becomes owner of that field. | ||
func (u *PatchingManagedFieldsUpgrader) Upgrade(ctx context.Context, obj client.Object, ssaManager string, _ ...string) error { |
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.
nit: ManagedFieldsUpgrader
is an internal interface and the only two implementations are this one and NopManagedFieldsUpgrader
, none of them uses the csaManagers
now, so we could as well directly drop it.
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.
I think it's useful to have two implementations (Nop and Patching) because it allows us to use the Nop implementation by default, but use the Patching implementation when the claim SSA feature flag is enabled.
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.
Nono, sure, I was talking about the csamanagers argument to the function.
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.
I meant this #5641
Description of your changes
Fixes #5498
@ravlilr this PR achieves the same thing as #5550. I'm not sure whether this approach is better. For now I'm just experimenting.
Take a look at the commentary on the updated
Upgrade
method for details on how it works. The short version is that it removes all field managers. This causes the API server to create a specialbefore-first-apply
field manager, which it then also deletes (the second time it's called). The result appears to be a successful 'upgrade', with no shared field managers.I have:
make reviewable
to ensure this PR is ready for review.Added or updated unit tests.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.y
labels to auto-backport this PR.Need help with this checklist? See the cheat sheet.