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

Clear XR field managers when upgrading to claim SSA #5555

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

negz
Copy link
Member

@negz negz commented Apr 6, 2024

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 special before-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:

Need help with this checklist? See the cheat sheet.

@negz negz marked this pull request as ready for review April 19, 2024 22:05
@negz negz requested a review from a team as a code owner April 19, 2024 22:05
@negz negz requested a review from turkenh April 19, 2024 22:05
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>
@negz
Copy link
Member Author

negz commented Apr 22, 2024

@ravilr I've updated the PR based on your review.

@turkenh @phisco @bobh66 - I'll need a review from a maintainer before I can merge.

@ravilr
Copy link
Contributor

ravilr commented Apr 23, 2024

thanks, LGTM.

@jbw976
Copy link
Member

jbw976 commented Apr 24, 2024

This comment from @ravilr about also needing similar clearing of field managers in composed resources seems relevant for this PR also: #5498 (comment)

@negz
Copy link
Member Author

negz commented Apr 25, 2024

This comment from @ravilr about also needing similar clearing of field managers in composed resources seems relevant for this PR also: #5498 (comment)

I'd rather @ravilr or I tackle that in a separate PR, rather than expand the scope of this one.

@jbw976
Copy link
Member

jbw976 commented Apr 26, 2024

I'd rather @ravilr or I tackle that in a separate PR, rather than expand the scope of this one.

Totally reasonable @negz! 🙇‍♂️

Copy link
Contributor

@phisco phisco left a 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 {
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant this #5641

@negz negz merged commit ee7dd21 into crossplane:master Apr 29, 2024
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enabling ssa-claims feature flag in crossplane-1.15 on a cluster with existing claims is not upgrade-safe
4 participants