diff --git a/pkg/triggers/watcher.go b/pkg/triggers/watcher.go index dab5bd8581b..b06d1affd9d 100644 --- a/pkg/triggers/watcher.go +++ b/pkg/triggers/watcher.go @@ -63,14 +63,21 @@ func newK8sInformers(clientset kubernetes.Interface, testKubeClientset versioned k8sInformers.clusterEventInformers = append(k8sInformers.clusterEventInformers, f.Core().V1().Events()) k8sInformers.configMapInformers = append(k8sInformers.configMapInformers, f.Core().V1().ConfigMaps()) - var testkubeInformerFactory externalversions.SharedInformerFactory - testkubeInformerFactory = externalversions.NewSharedInformerFactoryWithOptions( - testKubeClientset, 0, externalversions.WithNamespace(namespace)) - k8sInformers.testTriggerInformers = append(k8sInformers.testTriggerInformers, testkubeInformerFactory.Tests().V1().TestTriggers()) - k8sInformers.testSuiteInformers = append(k8sInformers.testSuiteInformers, testkubeInformerFactory.Tests().V2().TestSuites()) - k8sInformers.testInformers = append(k8sInformers.testInformers, testkubeInformerFactory.Tests().V3().Tests()) } + var watchedNamespaces string + if watchTestkubeCrAllNamespaces == true { + watchedNamespaces = v1.NamespaceAll + } else { + watchedNamespaces = testkubeNamespace + } + var testkubeInformerFactory externalversions.SharedInformerFactory + testkubeInformerFactory = externalversions.NewSharedInformerFactoryWithOptions( + testKubeClientset, 0, externalversions.WithNamespace(watchedNamespaces)) + k8sInformers.testTriggerInformers = append(k8sInformers.testTriggerInformers, testkubeInformerFactory.Tests().V1().TestTriggers()) + k8sInformers.testSuiteInformers = append(k8sInformers.testSuiteInformers, testkubeInformerFactory.Tests().V2().TestSuites()) + k8sInformers.testInformers = append(k8sInformers.testInformers, testkubeInformerFactory.Tests().V3().Tests()) + return &k8sInformers }