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