Skip to content

Commit

Permalink
Optional watch all namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric McKinnie committed Jun 30, 2023
1 parent 2465ba7 commit 9e7db4f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pkg/triggers/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9e7db4f

Please sign in to comment.