Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions pkg/console/controllers/oidcsetup/oidcsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type oidcSetupController struct {
authnLister configv1listers.AuthenticationLister
consoleOperatorLister operatorv1listers.ConsoleLister
configConfigMapLister corev1listers.ConfigMapLister
configSecretsLister corev1listers.SecretLister
targetNSSecretsLister corev1listers.SecretLister
targetNSConfigMapLister corev1listers.ConfigMapLister
targetNSDeploymentsLister appsv1listers.DeploymentLister
Expand All @@ -74,6 +75,7 @@ func NewOIDCSetupController(
authenticationClient configv1client.AuthenticationInterface,
consoleOperatorInformer operatorv1informers.ConsoleInformer,
configConfigMapInformer corev1informers.ConfigMapInformer,
configSecretInformer corev1informers.SecretInformer,
targetNSsecretsInformer corev1informers.SecretInformer,
targetNSConfigMapInformer corev1informers.ConfigMapInformer,
targetNSDeploymentsInformer appsv1informers.DeploymentInformer,
Expand All @@ -87,6 +89,7 @@ func NewOIDCSetupController(
authnLister: authnInformer.Lister(),
consoleOperatorLister: consoleOperatorInformer.Lister(),
configConfigMapLister: configConfigMapInformer.Lister(),
configSecretsLister: configSecretInformer.Lister(),
targetNSSecretsLister: targetNSsecretsInformer.Lister(),
targetNSDeploymentsLister: targetNSDeploymentsInformer.Lister(),
targetNSConfigMapLister: targetNSConfigMapInformer.Lister(),
Expand All @@ -102,6 +105,7 @@ func NewOIDCSetupController(
authnInformer.Informer(),
configConfigMapInformer.Informer(),
consoleOperatorInformer.Informer(),
configSecretInformer.Informer(),
targetNSsecretsInformer.Informer(),
targetNSDeploymentsInformer.Informer(),
targetNSConfigMapInformer.Informer(),
Expand Down Expand Up @@ -200,7 +204,7 @@ func (c *oidcSetupController) syncAuthTypeOIDC(ctx context.Context, authnConfig
return nil
}

clientSecret, err := c.targetNSSecretsLister.Secrets(api.TargetNamespace).Get("console-oauth-config")
clientSecret, err := c.configSecretsLister.Secrets(api.OpenShiftConfigNamespace).Get(clientConfig.ClientSecret.Name)
if err != nil {
c.authStatusHandler.Degraded("OIDCClientSecretGet", err.Error())
return err
Expand Down Expand Up @@ -252,7 +256,14 @@ func (c *oidcSetupController) checkClientConfigStatus(authnConfig *configv1.Auth
return false, "deployment unavailable or outdated", nil
}

if clientSecret.GetResourceVersion() != depl.ObjectMeta.Annotations["console.openshift.io/oauth-secret-version"] {
// Get the TARGET secret (synced copy in openshift-console namespace)
// to compare its resource version with the deployment annotation
targetClientSecret, err := c.targetNSSecretsLister.Secrets(api.OpenShiftConsoleNamespace).Get("console-oauth-config")
if err != nil {
return false, "", err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap the error with additional context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typically that's what I'd do, but this is the convention in this controller, to bubble up errors as-is and rely on the higher level to handle that 🤷🏽 you'll see that in many other places, e.g. line 278

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because it is convention, doesn't mean we can't do better now ;).

But this is a more of a nit so I won't block on it.

Copy link
Contributor Author

@devguyio devguyio Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because it is convention, doesn't mean we can't do better now ;).
I see your point, and I try to do "leave the code better than you found it". However, I wouldn't feel comfortable introducing such a change in convention without before:

  1. I get an understanding of the reasons behind that convention from the project/repo maintainers.
  2. I agree on a scope of the change upfront, because changing this single instance, IMHO, would leave the code in a more confusing state than how it was 😉 , with inconsistencies due to the two conventions existing.

Just my two cents, but agreed, it's a nit and I am not opposing the change, just wanna make sure that it's a change that has the project approvers buy-in, and that we've clarity around unifying that moving forward 😃 .

Thanks for the feedback!

}

if targetClientSecret.GetResourceVersion() != depl.ObjectMeta.Annotations["console.openshift.io/oauth-secret-version"] {
return false, "client secret version not up to date in current deployment", nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/console/operator/sync_v400.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
if err != nil {
return statusHandler.FlushAndReturn(err)
}
default:
// Clear OIDC-related conditions when auth type is not OIDC
statusHandler.AddConditions(status.HandleProgressingOrDegraded("OIDCProviderTrustedAuthorityConfigGet", "", nil))
}

customLogosErr, customLogosErrReason := co.SyncCustomLogos(updatedOperatorConfig)
Expand Down
1 change: 1 addition & 0 deletions pkg/console/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle
configClient.ConfigV1().Authentications(),
operatorConfigInformers.Operator().V1().Consoles(),
kubeInformersConfigNamespaced.Core().V1().ConfigMaps(),
kubeInformersConfigNamespaced.Core().V1().Secrets(),
kubeInformersNamespaced.Core().V1().Secrets(),
kubeInformersNamespaced.Core().V1().ConfigMaps(),
kubeInformersNamespaced.Apps().V1().Deployments(),
Expand Down