@@ -12,13 +12,15 @@ import (
12
12
"github.com/openshift/multi-operator-manager/pkg/library/libraryapplyconfiguration"
13
13
14
14
configv1 "github.com/openshift/api/config/v1"
15
+ "github.com/openshift/api/features"
15
16
operatorv1 "github.com/openshift/api/operator/v1"
16
17
routev1 "github.com/openshift/api/route/v1"
17
18
applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1"
18
19
"github.com/openshift/cluster-authentication-operator/bindata"
19
20
"github.com/openshift/cluster-authentication-operator/pkg/controllers/configobservation/configobservercontroller"
20
21
componentroutesecretsync "github.com/openshift/cluster-authentication-operator/pkg/controllers/customroute"
21
22
"github.com/openshift/cluster-authentication-operator/pkg/controllers/deployment"
23
+ "github.com/openshift/cluster-authentication-operator/pkg/controllers/externaloidc"
22
24
"github.com/openshift/cluster-authentication-operator/pkg/controllers/ingressnodesavailable"
23
25
"github.com/openshift/cluster-authentication-operator/pkg/controllers/ingressstate"
24
26
"github.com/openshift/cluster-authentication-operator/pkg/controllers/metadata"
@@ -39,6 +41,7 @@ import (
39
41
workloadcontroller "github.com/openshift/library-go/pkg/operator/apiserver/controller/workload"
40
42
apiservercontrollerset "github.com/openshift/library-go/pkg/operator/apiserver/controllerset"
41
43
"github.com/openshift/library-go/pkg/operator/certrotation"
44
+ "github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
42
45
"github.com/openshift/library-go/pkg/operator/csr"
43
46
"github.com/openshift/library-go/pkg/operator/encryption"
44
47
"github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators"
@@ -673,6 +676,52 @@ func prepareOauthAPIServerOperator(
673
676
return runOnceFns , runFns , nil
674
677
}
675
678
679
+ func prepareExternalOIDC (
680
+ ctx context.Context ,
681
+ authOperatorInput * authenticationOperatorInput ,
682
+ informerFactories authenticationOperatorInformerFactories ,
683
+ ) ([]libraryapplyconfiguration.NamedRunOnce , []libraryapplyconfiguration.RunFunc , error ) {
684
+
685
+ // By default, this will exit(0) if the featuregates change
686
+ featureGateAccessor := featuregates .NewFeatureGateAccess (
687
+ status .VersionForOperatorFromEnv (), "0.0.1-snapshot" ,
688
+ informerFactories .operatorConfigInformer .Config ().V1 ().ClusterVersions (),
689
+ informerFactories .operatorConfigInformer .Config ().V1 ().FeatureGates (),
690
+ authOperatorInput .eventRecorder ,
691
+ )
692
+ go featureGateAccessor .Run (ctx )
693
+ go informerFactories .operatorConfigInformer .Start (ctx .Done ())
694
+
695
+ var featureGates featuregates.FeatureGate
696
+ select {
697
+ case <- featureGateAccessor .InitialFeatureGatesObserved ():
698
+ featureGates , _ = featureGateAccessor .CurrentFeatureGates ()
699
+ case <- time .After (1 * time .Minute ):
700
+ return nil , nil , fmt .Errorf ("timed out waiting for FeatureGate detection" )
701
+ }
702
+
703
+ if ! featureGates .Enabled (features .FeatureGateExternalOIDC ) {
704
+ return nil , nil , nil
705
+ }
706
+
707
+ externalOIDCController := externaloidc .NewExternalOIDCController (
708
+ informerFactories .kubeInformersForNamespaces ,
709
+ informerFactories .operatorConfigInformer ,
710
+ authOperatorInput .authenticationOperatorClient ,
711
+ authOperatorInput .kubeClient .CoreV1 (),
712
+ authOperatorInput .eventRecorder ,
713
+ )
714
+
715
+ runOnceFns := []libraryapplyconfiguration.NamedRunOnce {
716
+ libraryapplyconfiguration .AdaptSyncFn (authOperatorInput .eventRecorder , "TODO-other-externalOIDCController" , externalOIDCController .Sync ),
717
+ }
718
+ runFns := []libraryapplyconfiguration.RunFunc {
719
+ libraryapplyconfiguration .AdaptRunFn (externalOIDCController .Run ),
720
+ }
721
+
722
+ return runOnceFns , runFns , nil
723
+ }
724
+
676
725
func singleNameListOptions (name string ) func (opts * metav1.ListOptions ) {
677
726
return func (opts * metav1.ListOptions ) {
678
727
opts .FieldSelector = fields .OneTermEqualSelector ("metadata.name" , name ).String ()
0 commit comments