Skip to content

Commit bd2c406

Browse files
committed
fix(catalog): Reduce namespace resync in resolution failure
Every resolution error will trigger namespace resync up to 8 times. This sometimes leads to excessive resync even though the problem is persistent. NotSatisfiable error from resolver is often terminal and require further manual intervetion. This type of error usually won't get resolved by retrying resolution. As a result, if catalog encounters this error, it should move on and doesn't force immediate resync. The resync will happen naturally later when the default resync is triggered. Signed-off-by: Vu Dinh <[email protected]>
1 parent f5292da commit bd2c406

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/controller/operators/catalog/operator.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/grpc"
5151
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler"
5252
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver"
53+
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/solver"
5354
controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
5455
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/event"
5556
index "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/index"
@@ -886,6 +887,16 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
886887
steps, bundleLookups, updatedSubs, err := o.resolver.ResolveSteps(namespace, querier)
887888
if err != nil {
888889
go o.recorder.Event(ns, corev1.EventTypeWarning, "ResolutionFailed", err.Error())
890+
// If the error is constraints not satisfiable, then simply project the
891+
// resolution failure event and move on without returning the error.
892+
// Returning the error only triggers the namespace resync which is unnecessary
893+
// given not-satisfiable error is terminal and most likely require intervention
894+
// from users/admins. Resyncing the namespace again is unlikely to resolve
895+
// not-satisfiable error
896+
if errors.Is(err, solver.NotSatisfiable{}) {
897+
logger.WithError(err).Debug("resolution failed")
898+
return nil
899+
}
889900
return err
890901
}
891902

0 commit comments

Comments
 (0)