From 2625ded47cc8260b4a620fd45c2d440bb864413f Mon Sep 17 00:00:00 2001 From: Alexander Greene Date: Mon, 9 Oct 2023 06:22:40 -0700 Subject: [PATCH] Don't sync namespaces that have no subscriptions Problem: The catalog operator is logging many errors regarding missing operator groups in namespaces that have no operators installed. Solution: If a namespace has no subscriptions in it, do not check if an operator group is present in the namespace. Signed-off-by: Alexander Greene --- pkg/controller/operators/catalog/operator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller/operators/catalog/operator.go b/pkg/controller/operators/catalog/operator.go index dbbc581ce7..e97a2ce145 100644 --- a/pkg/controller/operators/catalog/operator.go +++ b/pkg/controller/operators/catalog/operator.go @@ -1152,6 +1152,12 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error { return err } + // If there are no subscriptions, don't attempt to sync the namespace. + if len(subs) == 0 { + logger.Debug(fmt.Sprintf("No subscriptions were found in namespace %v", namespace)) + return nil + } + ogLister := o.lister.OperatorsV1().OperatorGroupLister().OperatorGroups(namespace) failForwardEnabled, err := resolver.IsFailForwardEnabled(ogLister) if err != nil {