Don't update claim statuses after they've been deleted
Unless someone else added a finalizer (and didn't yet remove it) the claim will cease to exist as soon as the finalizer is removed, so there's nothing to update. Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
parent
8f84243a5a
commit
6e49f843c2
|
|
@ -357,12 +357,11 @@ func (r *ClaimReconciler) Reconcile(req reconcile.Request) (reconcile.Result, er
|
|||
return reconcile.Result{RequeueAfter: aShortWait}, errors.Wrap(r.client.Status().Update(ctx, claim), errUpdateClaimStatus)
|
||||
}
|
||||
|
||||
// We've successfully processed the delete, so there's no further
|
||||
// reconciliation to do. There's a good chance our claim no longer
|
||||
// exists, but we try update its status just in case it sticks around,
|
||||
// for example due to additional finalizers.
|
||||
claim.SetConditions(v1alpha1.Deleting(), v1alpha1.ReconcileSuccess())
|
||||
return reconcile.Result{Requeue: false}, errors.Wrap(IgnoreNotFound(r.client.Status().Update(ctx, claim)), errUpdateClaimStatus)
|
||||
// We've successfully deleted our claim and removed our finalizer. If we
|
||||
// assume we were the only controller that added a finalizer to this
|
||||
// claim then it should no longer exist and thus there is no point
|
||||
// trying to update its status.
|
||||
return reconcile.Result{Requeue: false}, nil
|
||||
}
|
||||
|
||||
// Claim reconcilers (should) watch for either claims with a resource ref,
|
||||
|
|
|
|||
|
|
@ -289,15 +289,6 @@ func TestClaimReconciler(t *testing.T) {
|
|||
return errUnexpected
|
||||
}
|
||||
}),
|
||||
MockStatusUpdate: test.NewMockStatusUpdateFn(nil, func(got runtime.Object) error {
|
||||
want := &MockClaim{}
|
||||
want.SetDeletionTimestamp(&now)
|
||||
want.SetConditions(v1alpha1.Deleting(), v1alpha1.ReconcileSuccess())
|
||||
if diff := cmp.Diff(want, got, test.EquateConditions()); diff != "" {
|
||||
t.Errorf("-want, +got:\n%s", diff)
|
||||
}
|
||||
return nil
|
||||
}),
|
||||
},
|
||||
s: MockSchemeWith(&MockClaim{}, &MockClass{}, &MockManaged{}),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue