Ceph: handle not-found error on delete.

Previously, delete was returning an error causing the drain-canary
to reconcile even though it no longer existed.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
This commit is contained in:
Rohan CJ committed 2020-04-03 19:10:45 +05:30
1 parent ecef80eda5
commit 03e92da102
1 file changed
+3 -1
@@ -92,7 +92,9 @@ func (r *ReconcileNode) reconcile(request reconcile.Request) (reconcile.Result,
// delete any canary deployments if the node doesn't exist
logger.Infof("deleting drain-canary deployment for deleted node %q", request.Name)
err = r.client.Delete(context.TODO(), deploy)
if err != nil {
if kerrors.IsNotFound(err) {
return reconcile.Result{}, nil
} else if err != nil {
return reconcile.Result{}, errors.Wrapf(err, "could not delete drain-canary deployment for deleted node %q", request.Name)
}
return reconcile.Result{}, nil