From 6f675429fd5d4bf15172cdf6e42b05671887dc1c Mon Sep 17 00:00:00 2001 From: Justin Taylor-Barrick <46463088+jbarrick-mesosphere@users.noreply.github.com> Date: Mon, 29 Jul 2019 00:18:07 -0700 Subject: [PATCH] Do not requeue PlanExecution reconciliation if Instance does not exist. (#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. --- pkg/controller/planexecution/planexecution_controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/controller/planexecution/planexecution_controller.go b/pkg/controller/planexecution/planexecution_controller.go index 2bf40096e..37de1d643 100644 --- a/pkg/controller/planexecution/planexecution_controller.go +++ b/pkg/controller/planexecution/planexecution_controller.go @@ -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 }