@@ -11,6 +11,8 @@ import (
11
11
"sync"
12
12
"time"
13
13
14
+ v1 "github.com/operator-framework/api/pkg/operators/v1"
15
+
14
16
errorwrap "github.com/pkg/errors"
15
17
"github.com/sirupsen/logrus"
16
18
"google.golang.org/grpc/connectivity"
@@ -260,7 +262,19 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
260
262
261
263
operatorGroupInformer := crInformerFactory .Operators ().V1 ().OperatorGroups ()
262
264
op .lister .OperatorsV1 ().RegisterOperatorGroupLister (metav1 .NamespaceAll , operatorGroupInformer .Lister ())
263
- if err := op .RegisterInformer (operatorGroupInformer .Informer ()); err != nil {
265
+ ogQueue := workqueue .NewNamedRateLimitingQueue (workqueue .DefaultControllerRateLimiter (), "ogs" )
266
+ op .ogQueueSet .Set (metav1 .NamespaceAll , ogQueue )
267
+ operatorGroupQueueInformer , err := queueinformer .NewQueueInformer (
268
+ ctx ,
269
+ queueinformer .WithLogger (op .logger ),
270
+ queueinformer .WithQueue (ogQueue ),
271
+ queueinformer .WithInformer (operatorGroupInformer .Informer ()),
272
+ queueinformer .WithSyncer (queueinformer .LegacySyncHandler (op .syncOperatorGroups ).ToSyncer ()),
273
+ )
274
+ if err != nil {
275
+ return nil , err
276
+ }
277
+ if err := op .RegisterQueueInformer (operatorGroupQueueInformer ); err != nil {
264
278
return nil , err
265
279
}
266
280
@@ -1086,6 +1100,20 @@ func (o *Operator) syncSubscriptions(obj interface{}) error {
1086
1100
return nil
1087
1101
}
1088
1102
1103
+ // syncOperatorGroups requeues the namespace resolution queue on changes to an operatorgroup
1104
+ // This is because the operatorgroup is now an input to resolution via the global catalog exclusion annotation
1105
+ func (o * Operator ) syncOperatorGroups (obj interface {}) error {
1106
+ og , ok := obj .(* v1.OperatorGroup )
1107
+ if ! ok {
1108
+ o .logger .Debugf ("wrong type: %#v" , obj )
1109
+ return fmt .Errorf ("casting OperatorGroup failed" )
1110
+ }
1111
+
1112
+ o .nsResolveQueue .Add (og .GetNamespace ())
1113
+
1114
+ return nil
1115
+ }
1116
+
1089
1117
func (o * Operator ) nothingToUpdate (logger * logrus.Entry , sub * v1alpha1.Subscription ) bool {
1090
1118
if sub .Status .InstallPlanRef != nil && sub .Status .State == v1alpha1 .SubscriptionStateUpgradePending {
1091
1119
logger .Debugf ("skipping update: installplan already created" )
0 commit comments