@@ -28,6 +28,7 @@ import (
28
28
"k8s.io/apimachinery/pkg/labels"
29
29
"k8s.io/apimachinery/pkg/runtime"
30
30
"k8s.io/apimachinery/pkg/runtime/schema"
31
+ "k8s.io/apimachinery/pkg/selection"
31
32
utilclock "k8s.io/apimachinery/pkg/util/clock"
32
33
utilerrors "k8s.io/apimachinery/pkg/util/errors"
33
34
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -312,10 +313,32 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
312
313
op .lister .CoreV1 ().RegisterServiceLister (metav1 .NamespaceAll , serviceInformer .Lister ())
313
314
sharedIndexInformers = append (sharedIndexInformers , serviceInformer .Informer ())
314
315
315
- // Wire Pods
316
- podInformer := k8sInformerFactory .Core ().V1 ().Pods ()
317
- op .lister .CoreV1 ().RegisterPodLister (metav1 .NamespaceAll , podInformer .Lister ())
318
- sharedIndexInformers = append (sharedIndexInformers , podInformer .Informer ())
316
+ // Wire Pods for CatalogSource
317
+ catsrcReq , err := labels .NewRequirement (reconciler .CatalogSourceLabelKey , selection .Exists , nil )
318
+ if err != nil {
319
+ return nil , err
320
+ }
321
+
322
+ csPodLabels := labels .NewSelector ()
323
+ csPodLabels = csPodLabels .Add (* catsrcReq )
324
+ csPodInformer := informers .NewSharedInformerFactoryWithOptions (op .opClient .KubernetesInterface (), resyncPeriod (), informers .WithTweakListOptions (func (options * metav1.ListOptions ) {
325
+ options .LabelSelector = csPodLabels .String ()
326
+ })).Core ().V1 ().Pods ()
327
+ op .lister .CoreV1 ().RegisterPodLister (metav1 .NamespaceAll , csPodInformer .Lister ())
328
+ sharedIndexInformers = append (sharedIndexInformers , csPodInformer .Informer ())
329
+
330
+ // Wire Pods for BundleUnpack job
331
+ buReq , err := labels .NewRequirement (bundle .BundleUnpackPodLabel , selection .Exists , nil )
332
+ if err != nil {
333
+ return nil , err
334
+ }
335
+
336
+ buPodLabels := labels .NewSelector ()
337
+ buPodLabels = buPodLabels .Add (* buReq )
338
+ buPodInformer := informers .NewSharedInformerFactoryWithOptions (op .opClient .KubernetesInterface (), resyncPeriod (), informers .WithTweakListOptions (func (options * metav1.ListOptions ) {
339
+ options .LabelSelector = buPodLabels .String ()
340
+ })).Core ().V1 ().Pods ()
341
+ sharedIndexInformers = append (sharedIndexInformers , buPodInformer .Informer ())
319
342
320
343
// Wire ConfigMaps
321
344
configMapInformer := k8sInformerFactory .Core ().V1 ().ConfigMaps ()
@@ -346,11 +369,12 @@ func NewOperator(ctx context.Context, kubeconfigPath string, clock utilclock.Clo
346
369
347
370
// Setup the BundleUnpacker
348
371
op .bundleUnpacker , err = bundle .NewConfigmapUnpacker (
372
+ bundle .WithLogger (op .logger ),
349
373
bundle .WithClient (op .opClient .KubernetesInterface ()),
350
374
bundle .WithCatalogSourceLister (catsrcInformer .Lister ()),
351
375
bundle .WithConfigMapLister (configMapInformer .Lister ()),
352
376
bundle .WithJobLister (jobInformer .Lister ()),
353
- bundle .WithPodLister (podInformer .Lister ()),
377
+ bundle .WithPodLister (buPodInformer .Lister ()),
354
378
bundle .WithRoleLister (roleInformer .Lister ()),
355
379
bundle .WithRoleBindingLister (roleBindingInformer .Lister ()),
356
380
bundle .WithOPMImage (opmImage ),
0 commit comments