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 #564

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
@darkowlzz darkowlzz force-pushed the delete-before-finalize branch 2 times, most recently from 347afa3 to a2cfdbe Compare July 26, 2023 18:40
In Reconcile() method, move the object deletion above add finalizer.
Finalizers can't be set when an object is being deleted.

Introduce a cacheless client in suite_test to use for testing this
change. It ensures that the Reconcile() call always operates on the
latest version of the object which has the deletion timestamp and
existing finalizer.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
@darkowlzz darkowlzz force-pushed the delete-before-finalize branch from a2cfdbe to eabd20b Compare July 31, 2023 10:02
@darkowlzz darkowlzz merged commit 09aa2ac into main Jul 31, 2023
@darkowlzz darkowlzz deleted the delete-before-finalize branch July 31, 2023 14:02
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