Skip to content

Commit

Permalink
Do not requeue PlanExecution reconciliation if Instance does not exis…
Browse files Browse the repository at this point in the history
…t. (#657)

* Do not requeue PlanExecution reconciliation if Instance does not exist.

If an Instance does not exist, the PlanExecution controller returns an error when its PlanExecution is reconciled. Because the PlanExecution controller returns an error if the Instance does not exist and controller-runtime will automatically requeue an object for reconciliation if an error is returned, we essentially enter an infinite loop reconciling deleted Instances.

This modifies the method to only log that the Instance does not exist and not return an error so that it will not be requeued.

This cuts test run time from ~80 seconds to ~20 and fixes the flakiness with the create-operator-in-operator test.

* Only skip requeuing for IsNotFound errors.
  • Loading branch information
jbarrick-mesosphere authored and alenkacz committed Jul 29, 2019
1 parent ad10396 commit 6f67542
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/planexecution/planexecution_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ func (r *ReconcilePlanExecution) Reconcile(request reconcile.Request) (reconcile
planExecution.Spec.Instance.Name,
planExecution.Spec.Instance.Namespace,
err)

if errors.IsNotFound(err) {
return reconcile.Result{}, nil
}

return reconcile.Result{}, err
}

Expand Down

0 comments on commit 6f67542

Please sign in to comment.