Skip to content

Commit 68e37a8

Browse files
committed
oidcsetup: move no-OIDC handling above OIDC sync
1 parent d99ae79 commit 68e37a8

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

pkg/console/controllers/oidcsetup/oidcsetup.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,27 @@ func (c *oidcSetupController) sync(ctx context.Context, syncCtx factory.SyncCont
136136
return err
137137
}
138138

139+
if authnConfig.Spec.Type != configv1.AuthenticationTypeOIDC {
140+
applyErr := c.authStatusHandler.Apply(ctx, authnConfig)
141+
statusHandler.AddConditions(status.HandleProgressingOrDegraded("AuthStatusHandler", "FailedApply", applyErr))
142+
143+
// reset the other condition set by this controller
144+
statusHandler.AddConditions(status.HandleProgressingOrDegraded("OIDCClientConfig", "", nil))
145+
return statusHandler.FlushAndReturn(applyErr)
146+
}
147+
139148
// we need to keep track of errors during the sync so that we can requeue
140149
// if any occur
141150
var errs []error
142-
if authnConfig.Spec.Type == configv1.AuthenticationTypeOIDC {
143-
syncErr := c.syncAuthTypeOIDC(ctx, syncCtx, statusHandler, operatorConfig, authnConfig)
144-
statusHandler.AddConditions(
145-
status.HandleProgressingOrDegraded(
146-
"OIDCClientConfig", "OIDCConfigSyncFailed",
147-
syncErr,
148-
),
149-
)
150-
if syncErr != nil {
151-
errs = append(errs, syncErr)
152-
}
151+
syncErr := c.syncAuthTypeOIDC(ctx, syncCtx, statusHandler, operatorConfig, authnConfig)
152+
statusHandler.AddConditions(
153+
status.HandleProgressingOrDegraded(
154+
"OIDCClientConfig", "OIDCConfigSyncFailed",
155+
syncErr,
156+
),
157+
)
158+
if syncErr != nil {
159+
errs = append(errs, syncErr)
153160
}
154161

155162
applyErr := c.authStatusHandler.Apply(ctx, authnConfig)

0 commit comments

Comments
 (0)