@@ -42,6 +42,7 @@ import (
4242 "k8s.io/client-go/util/workqueue"
4343
4444 "github.com/operator-framework/api/pkg/operators/reference"
45+ operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
4546 "github.com/operator-framework/api/pkg/operators/v1alpha1"
4647 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
4748 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/informers/externalversions"
@@ -260,7 +261,19 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
260261
261262 operatorGroupInformer := crInformerFactory .Operators ().V1 ().OperatorGroups ()
262263 op .lister .OperatorsV1 ().RegisterOperatorGroupLister (metav1 .NamespaceAll , operatorGroupInformer .Lister ())
263- if err := op .RegisterInformer (operatorGroupInformer .Informer ()); err != nil {
264+ ogQueue := workqueue .NewNamedRateLimitingQueue (workqueue .DefaultControllerRateLimiter (), "ogs" )
265+ op .ogQueueSet .Set (metav1 .NamespaceAll , ogQueue )
266+ operatorGroupQueueInformer , err := queueinformer .NewQueueInformer (
267+ ctx ,
268+ queueinformer .WithLogger (op .logger ),
269+ queueinformer .WithQueue (ogQueue ),
270+ queueinformer .WithInformer (operatorGroupInformer .Informer ()),
271+ queueinformer .WithSyncer (queueinformer .LegacySyncHandler (op .syncOperatorGroups ).ToSyncer ()),
272+ )
273+ if err != nil {
274+ return nil , err
275+ }
276+ if err := op .RegisterQueueInformer (operatorGroupQueueInformer ); err != nil {
264277 return nil , err
265278 }
266279
@@ -1086,6 +1099,20 @@ func (o *Operator) syncSubscriptions(obj interface{}) error {
10861099 return nil
10871100}
10881101
1102+ // syncOperatorGroups requeues the namespace resolution queue on changes to an operatorgroup
1103+ // This is because the operatorgroup is now an input to resolution via the global catalog exclusion annotation
1104+ func (o * Operator ) syncOperatorGroups (obj interface {}) error {
1105+ og , ok := obj .(* operatorsv1.OperatorGroup )
1106+ if ! ok {
1107+ o .logger .Debugf ("wrong type: %#v" , obj )
1108+ return fmt .Errorf ("casting OperatorGroup failed" )
1109+ }
1110+
1111+ o .nsResolveQueue .Add (og .GetNamespace ())
1112+
1113+ return nil
1114+ }
1115+
10891116func (o * Operator ) nothingToUpdate (logger * logrus.Entry , sub * v1alpha1.Subscription ) bool {
10901117 if sub .Status .InstallPlanRef != nil && sub .Status .State == v1alpha1 .SubscriptionStateUpgradePending {
10911118 logger .Debugf ("skipping update: installplan already created" )
0 commit comments