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. |
|
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'sReadyToClearFinalizercan 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#Finalizehook.