-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Bug Report
We have a finalizer defined in our watch.yaml, if we update a watched CR, then delete the CR while it is running an ansible reconcile role, the finalizer is never called. This is new behaviour, caused I believe by #4407
What did you do?
Create a CR for an operator which has a finalizer defined, delete it while a reconciliation role or playbook is running.
What did you expect to see?
The current reconcile should complete, then the finalizer role or playbook should be executed.
What did you see instead? Under which circumstances?
The current (non finalizer) reconcile completes, the finalizer on the CR is deleted because the metadata.deletionTimestamp is set, on the next run, we see Resource is terminated, skipping reconciliation
in the log and no finalization role is run.
Environment
Operator type:
/language ansible
Kubernetes cluster type:
OpenShift 4.6.16
$ operator-sdk version
1.15
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0+263ee0d", GitCommit:"263ee0d276ef68a1958d000be103d7c69f3e5494", GitTreeState:"clean", BuildDate:"2021-03-21T08:03:52Z", GoVersion:"go1.15.7", Compiler:"gc", Platform:"linux/amd64"}
Possible Solution
The reconcile.go Run method is removing the finalizer after calling Runner.Run. It uses the CR deletion timestamp as the condition to do this, however the deletion timestamp may have been added during the run.
One solution would be for reconcile.go to introspect the reconcileResult to determine if this was a finalizer run as the condition for removing the finalizer.