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

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Conversation

darkowlzz
Copy link
Contributor

In Reconcile() methods, 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

@makkes makkes left a comment

Choose a reason for hiding this comment

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

@darkowlzz Good spotting. Is there a way we can add a regression test for this case?

In Reconcile() methods, 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>
@darkowlzz
Copy link
Contributor Author

Is there a way we can add a regression test for this case?

Added a test for it across all the reconcilers.

@darkowlzz darkowlzz merged commit a786a48 into main Jul 26, 2023
6 checks passed
@darkowlzz darkowlzz deleted the delete-before-finalize branch July 26, 2023 11:20
@stefanprodan stefanprodan added the backport:release/v1.0.x To be backported to release/v1.0.x label Jul 31, 2023
@fluxcdbot
Copy link
Member

Successfully created backport PR for release/v1.0.x:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:release/v1.0.x To be backported to release/v1.0.x enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants