@@ -61,7 +61,6 @@ type oauthClientsController struct {
61
61
configNSSecretsLister corev1listers.SecretLister
62
62
targetNSDeploymentsLister appsv1listers.DeploymentLister
63
63
targetNSConfigLister corev1listers.ConfigMapLister
64
- featureGatesLister configv1lister.FeatureGateLister
65
64
66
65
authStatusHandler status.AuthStatusHandler
67
66
}
@@ -81,7 +80,6 @@ func NewOAuthClientsController(
81
80
targetNSConfigInformer corev1informers.ConfigMapInformer ,
82
81
targetNSDeploymentsInformer appsv1informers.DeploymentInformer ,
83
82
oauthClientSwitchedInformer * util.InformerWithSwitch ,
84
- featureGatesInformer configv1informers.FeatureGateInformer ,
85
83
recorder events.Recorder ,
86
84
) factory.Controller {
87
85
c := oauthClientsController {
@@ -100,7 +98,6 @@ func NewOAuthClientsController(
100
98
configNSSecretsLister : configNSSecretsInformer .Lister (),
101
99
targetNSConfigLister : targetNSConfigInformer .Lister (),
102
100
targetNSDeploymentsLister : targetNSDeploymentsInformer .Lister (),
103
- featureGatesLister : featureGatesInformer .Lister (),
104
101
105
102
authStatusHandler : status .NewAuthStatusHandler (authentication , api .OpenShiftConsoleName , api .TargetNamespace , api .OpenShiftConsoleOperator ),
106
103
}
@@ -149,11 +146,6 @@ func (c *oauthClientsController) sync(ctx context.Context, controllerContext fac
149
146
return err
150
147
}
151
148
152
- featureGates , err := c .featureGatesLister .Get (api .ConfigResourceName )
153
- if err != nil {
154
- return err
155
- }
156
-
157
149
routeName := api .OpenShiftConsoleRouteName
158
150
routeConfig := routesub .NewRouteConfig (operatorConfig , ingressConfig , routeName )
159
151
if routeConfig .IsCustomHostnameSet () {
@@ -191,11 +183,18 @@ func (c *oauthClientsController) sync(ctx context.Context, controllerContext fac
191
183
192
184
case configv1 .AuthenticationTypeOIDC :
193
185
syncErr = c .syncAuthTypeOIDC (ctx , controllerContext , statusHandler , operatorConfig , authnConfig )
194
- }
186
+ if syncErr != nil {
187
+ break
188
+ }
195
189
196
- // AuthStatusHandler manages fields that are behind the CustomNoUpgrade and TechPreviewNoUpgrade featuregate sets
197
- // call Apply() only if they are enabled, otherwise server-side apply will complain
198
- if featureGates .Spec .FeatureSet == configv1 .TechPreviewNoUpgrade || featureGates .Spec .FeatureSet == configv1 .CustomNoUpgrade {
190
+ // FIXME: once we're able to distinguish featuregates for HCP (on by default)
191
+ // and OCP (currently only in TechPreview), move this outside of the switch.
192
+ // If you don't, GitOps people will give you a lot of hate - the API validation
193
+ // does not allow setting the OIDC providers' client in the provider if it
194
+ // doesn't already appear in the status, which is what the following does.
195
+ // This means that you cannot get to the desired state in a single update
196
+ // as you first need to set the Authn type to OIDC, wait for the operator to
197
+ // set the client, and only then you can configure the client in the provider.
199
198
if err := c .authStatusHandler .Apply (ctx , authnConfig ); err != nil {
200
199
statusHandler .AddConditions (status .HandleProgressingOrDegraded ("AuthStatusHandler" , "FailedApply" , err ))
201
200
return statusHandler .FlushAndReturn (err )
0 commit comments