-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Due to a different problem that I have to figure out, I noticed the following possibly wrong behavior of the sdk ...
I apply the custom resource handled by my controller and the handleDispatch reaches the point where a finalizer is applied to the resource itself. At that point an exception happens (in my case a 404 NOT FOUND) and the handleExecution of the dispatcher is executed and the execution ends (without calling the createOrUpdateResource of my controller which is ok).
AFAIK the operator sdk has a retry logic so the event is handled again but at this point in the handleCreateOrUpdate the ControllerUtils.hasGivenFinalizer return true because the resource (is it in a cache of the operator sdk?) has the finalizer in the metadata even if the corresponding apply in the previous step was failed against the Kubernetes cluster.
Due to the fact that the finalizer is there, the operator sdk goes ahead handling the event calling the createOrUpdateResource of the controller.
I guess it's wrong, because applying the finalizer didn't end well actually due to a problem that could be of any type and could happen even in the controller.