Finalizers behavior on Exception #226
-
Hello, thank you for this great SDK. I have a question about finalizers' behavior - what happens if the FinalizeAsync throws an exception? Is finalizer removed, or will finalization be re-scheduled and repeated again? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't have anything set up right now to properly test this, but from digging through the code, I am relatively confident that the event will be re-queued and your finalizer will be called again. Based on the logic in Tracing up the call stack to ... and |
Beta Was this translation helpful? Give feedback.
I don't have anything set up right now to properly test this, but from digging through the code, I am relatively confident that the event will be re-queued and your finalizer will be called again.
Based on the logic in
FinalizerManager<TEntity>
, we can see that if any of your registeredIResourceFinalizer<TEntity>
instances throw an exception, they will not be removed from the resource, continuing to block deletion.dotnet-operator-sdk/src/KubeOps/Operator/Finalizer/FinalizerManager{TEntity}.cs
Lines 83 to 91 in 02bb7ec