Skip to content

Reintroduce default state machine for Provider controller #1112

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

Merged
merged 1 commit into from
May 7, 2025

Conversation

matheuscscp
Copy link
Member

@matheuscscp matheuscscp commented May 5, 2025

After introducing the token cache the Provider controller now has a reason to keep a finalizer at all times. It must use it to block the object deletion from etcd until it has a chance to observe it and cleanup the token cache. So instead of being a controller that tries to remove the finalizer all the time, it's now again a controller that tries to add the finalizer all the time until deletion is observed.

Comment on lines -85 to -92
// Suspend the provider to prevent finalizer from getting removed.
// Ensure only flux finalizer is set to allow the object to be garbage
// collected at the end.
// NOTE: Suspending and updating finalizers are done separately here as
// doing them in a single patch results in flaky test where the finalizer
// update doesn't gets registered with the kube-apiserver, resulting in
// timeout waiting for finalizer to appear on the object below.
provider.Spec.Suspend = true
Copy link
Member Author

@matheuscscp matheuscscp May 6, 2025

Choose a reason for hiding this comment

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

If in the previous version .suspend blocks removing the finalizer, in this PR it should block adding the finalizer. But we don't do this anywhere else, so I think .suspend is not needed for anything in this controller. (It's needed only in the event handler)

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

@matheuscscp matheuscscp merged commit 99c6dbb into main May 7, 2025
5 checks passed
@matheuscscp matheuscscp deleted the fix-provider-state-machine branch May 7, 2025 11:51
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.

2 participants