Description
/area API
/kind bug
This is a largely superficial issue, which I only noticed because of some unit testing I was writing and trying to explain this odd behavior.
Expected Behavior
If in FinalizeKind
a resource is marked Ready
, and nil
is returned, then we see both updates (path for finalizer, update status for Ready
).
Actual Behavior
Instead the finalizer is removed and the status is NOT updated.
The bug
Using Deployment
as an example... If in FinalizeKind
we update status and return nil
then we will call through here:
pkg/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go
Lines 242 to 244 in bfab3c8
This function uses the input resource
(with the updated status) to access the finalizers, find ours and remove it:
pkg/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go
Lines 438 to 441 in bfab3c8
The resource we pass in is used to compute a PATCH
on the finalizers specifically:
pkg/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go
Lines 373 to 378 in bfab3c8
However, any other mutations (e.g. our status update) are ignored here. This is a problem because the resource
that is returned by this function is the updated copy that is returned by the PATCH
which does not have our status update reflected:
pkg/client/injection/kube/reconciler/apps/v1beta1/deployment/reconciler.go
Lines 388 to 396 in bfab3c8