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

Handle delete before adding finalizer #930

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Conversation

darkowlzz
Copy link
Contributor

In Reconcile() method, move the object deletion above add finalizer. Finalizers can't be set when an object is being deleted.

Found by @hiddeco while working on helm-controller. Refer kubernetes-sigs/cluster-api@cef1cf1 .

@darkowlzz darkowlzz added the enhancement New feature or request label Jul 24, 2023
Copy link
Member

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

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

Backporting this change shouldn’t necessarily be required as we do not have multiple reconcilers handling this resource.

It could however become a problem if an arbitrary 3rd party registers a finalizer on the object.

Thanks @darkowlzz 🙇

In Reconcile() method, move the object deletion above add finalizer.
Finalizers can't be set when an object is being deleted.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
@stefanprodan stefanprodan merged commit f8dec02 into main Jul 31, 2023
6 checks passed
@stefanprodan stefanprodan deleted the delete-before-finalizer branch July 31, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants