-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conditional clearing of finalizers #525
Conditional clearing of finalizers #525
Conversation
WithFinalizer's ReadyToClearFinalizer can be used to define custom rules for clearing the finalizer. For example, deletion of a resource can be blocked until all child resources are fully deleted replicating the behavior of an owner reference in parent-child relationships that are not supported by owner references. Client lookups and advanced logic should be avoided as errors cannot be returned. Computed values can be retrieved that were stashed from a previous reconciler, like a SyncReconciler#Finalize hook. Signed-off-by: Scott Andrews <scott@andrews.me>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #525 +/- ##
==========================================
+ Coverage 59.59% 59.73% +0.13%
==========================================
Files 31 31
Lines 2772 2779 +7
==========================================
+ Hits 1652 1660 +8
+ Misses 1028 1027 -1
Partials 92 92 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
If the inner reconciler deleted some child resources and they're still in "finalize" state, is there a way I can use this hook to observe that without client lookups? |
Nope, that info isn't available from calling edit: I've considered introducing a side effect to |
I would have cleared the finalizer by then because "nothing went wrong". |
As is today, yes. With this new hook you can hold on to the finalizer until you're ready to release. Deciding when that is becomes your business logic. |
WithFinalizer
'sReadyToClearFinalizer
can be used to define custom rules for clearing the finalizer. For example, deletion of a resource can be blocked until all child resources are fully deleted replicating the behavior of an owner reference in parent-child relationships that are not supported by owner references. Client lookups and advanced logic should be avoided as errors cannot be returned. Computed values can be retrieved that were stashed from a previous reconciler, like aSyncReconciler#Finalize
hook.