@@ -16,6 +16,7 @@ import (
16
16
operatorv1 "github.com/openshift/api/operator/v1"
17
17
routev1 "github.com/openshift/api/route/v1"
18
18
configv1listers "github.com/openshift/client-go/config/listers/config/v1"
19
+ oauthinformers "github.com/openshift/client-go/oauth/informers/externalversions"
19
20
applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1"
20
21
operatorv1listers "github.com/openshift/client-go/operator/listers/operator/v1"
21
22
"github.com/openshift/cluster-authentication-operator/bindata"
@@ -28,6 +29,7 @@ import (
28
29
"github.com/openshift/cluster-authentication-operator/pkg/controllers/ingressstate"
29
30
"github.com/openshift/cluster-authentication-operator/pkg/controllers/metadata"
30
31
"github.com/openshift/cluster-authentication-operator/pkg/controllers/oauthclientscontroller"
32
+ "github.com/openshift/cluster-authentication-operator/pkg/controllers/oauthclientsswitchedinformer"
31
33
"github.com/openshift/cluster-authentication-operator/pkg/controllers/oauthendpoints"
32
34
"github.com/openshift/cluster-authentication-operator/pkg/controllers/payload"
33
35
"github.com/openshift/cluster-authentication-operator/pkg/controllers/proxyconfig"
@@ -41,6 +43,7 @@ import (
41
43
"github.com/openshift/cluster-authentication-operator/pkg/operator/workload"
42
44
"github.com/openshift/library-go/pkg/authentication/bootstrapauthenticator"
43
45
"github.com/openshift/library-go/pkg/controller/controllercmd"
46
+ "github.com/openshift/library-go/pkg/controller/factory"
44
47
workloadcontroller "github.com/openshift/library-go/pkg/operator/apiserver/controller/workload"
45
48
apiservercontrollerset "github.com/openshift/library-go/pkg/operator/apiserver/controllerset"
46
49
"github.com/openshift/library-go/pkg/operator/certrotation"
@@ -256,10 +259,25 @@ func prepareOauthOperator(
256
259
authOperatorInput .eventRecorder ,
257
260
)
258
261
262
+ oauthClientsSwitchedInformer := oauthclientsswitchedinformer .NewSwitchedInformer (
263
+ "OAuthClientsInformerWithSwitchController" ,
264
+ ctx ,
265
+ func () (bool , error ) {
266
+ return common .ExternalOIDCConfigAvailable (authLister , kasLister , kasConfigMapLister )
267
+ },
268
+ oauthinformers .NewSharedInformerFactoryWithOptions (authOperatorInput .oauthClient , 1 * time .Minute ).Oauth ().V1 ().OAuthClients ().Informer (),
269
+ 0 ,
270
+ []factory.Informer {
271
+ informerFactories .operatorInformer .Operator ().V1 ().KubeAPIServers ().Informer (),
272
+ informerFactories .operatorConfigInformer .Config ().V1 ().Authentications ().Informer (),
273
+ },
274
+ authOperatorInput .eventRecorder ,
275
+ )
276
+
259
277
oauthClientsController := oauthclientscontroller .NewOAuthClientsController (
260
278
authOperatorInput .authenticationOperatorClient ,
261
279
authOperatorInput .oauthClient .OauthV1 ().OAuthClients (),
262
- informerFactories . oauthInformers ,
280
+ oauthClientsSwitchedInformer ,
263
281
informerFactories .namespacedOpenshiftAuthenticationRoutes ,
264
282
informerFactories .operatorConfigInformer ,
265
283
informerFactories .operatorInformer .Operator ().V1 ().KubeAPIServers (),
@@ -386,6 +404,7 @@ func prepareOauthOperator(
386
404
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-deploymentController" , deploymentController .Sync ),
387
405
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-managementStateController" , managementStateController .Sync ),
388
406
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-metadataController" , metadataController .Sync ),
407
+ libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-oauthClientsSwitchedInformerController" , oauthClientsSwitchedInformer .Controller ().Sync ),
389
408
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-oauthClientsController" , oauthClientsController .Sync ),
390
409
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-payloadConfigController" , payloadConfigController .Sync ),
391
410
libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-routerCertsController" , routerCertsController .Sync ),
@@ -408,6 +427,7 @@ func prepareOauthOperator(
408
427
libraryapplyconfiguration .AdaptRunFn (deploymentController .Run ),
409
428
libraryapplyconfiguration .AdaptRunFn (managementStateController .Run ),
410
429
libraryapplyconfiguration .AdaptRunFn (metadataController .Run ),
430
+ libraryapplyconfiguration .AdaptRunFn (oauthClientsSwitchedInformer .Controller ().Run ),
411
431
libraryapplyconfiguration .AdaptRunFn (oauthClientsController .Run ),
412
432
libraryapplyconfiguration .AdaptRunFn (payloadConfigController .Run ),
413
433
libraryapplyconfiguration .AdaptRunFn (routerCertsController .Run ),
0 commit comments