@@ -12,19 +12,17 @@ import (
1212)
1313
1414type OperatorGroupToggleSourceProvider struct {
15- sp SourceProviderWithInvalidate
16- logger * logrus.Logger
17- ogLister v1listers.OperatorGroupLister
18- globalNamespace string
15+ sp SourceProviderWithInvalidate
16+ logger * logrus.Logger
17+ ogLister v1listers.OperatorGroupLister
1918}
2019
2120func NewOperatorGroupToggleSourceProvider (sp SourceProviderWithInvalidate , logger * logrus.Logger ,
22- ogLister v1listers.OperatorGroupLister , globalNamespace string ) * OperatorGroupToggleSourceProvider {
21+ ogLister v1listers.OperatorGroupLister ) * OperatorGroupToggleSourceProvider {
2322 return & OperatorGroupToggleSourceProvider {
24- sp : sp ,
25- logger : logger ,
26- ogLister : ogLister ,
27- globalNamespace : globalNamespace ,
23+ sp : sp ,
24+ logger : logger ,
25+ ogLister : ogLister ,
2826 }
2927}
3028
@@ -40,6 +38,7 @@ func (e *OperatorGroupToggleSourceProvider) Sources(namespaces ...string) map[ca
4038 // Check if annotation is set first
4139 resolutionNamespaces , err := e .CheckForExclusion (namespaces ... )
4240 if err != nil {
41+ e .logger .Errorf ("error checking namespaces %#v for global resolution exlusion: %s" , namespaces , err )
4342 // Fail early with a dummy Source that returns an error
4443 // Note: this only errors in the case the Lister fails, which should not happen
4544 // TODO: Update the Sources interface to return an error
@@ -70,17 +69,10 @@ func (e *OperatorGroupToggleSourceProvider) CheckForExclusion(namespaces ...stri
7069 var ownNamespace = namespaces [0 ]
7170 var toggledResult = []string {ownNamespace }
7271
73- if ownNamespace == e .globalNamespace {
74- // Global namespace is being synced
75- // Return early with default
76- return defaultResult , nil
77- }
78-
7972 // Check the OG on the NS provided for the exclusion annotation
8073 ogs , err := e .ogLister .OperatorGroups (ownNamespace ).List (labels .Everything ())
8174 if err != nil {
82- // Assume resolution was global in the case of an error (the default behavior)
83- return defaultResult , fmt .Errorf ("listing operatorgroups in namespace %s: %s" , ownNamespace , err )
75+ return nil , fmt .Errorf ("listing operatorgroups in namespace %s: %s" , ownNamespace , err )
8476 }
8577
8678 if len (ogs ) != 1 || ogs [0 ] == nil {
0 commit comments