Skip to content

Commit 434ca43

Browse files
Merge pull request #944 from jhadvig/OCPBUGS-45222
OCPBUGS-45222: Dont disable console when authConfig type is set to None
2 parents 5e4acb1 + 31e4a1d commit 434ca43

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

pkg/console/controllers/oauthclients/oauthclients.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func (c *oauthClientsController) sync(ctx context.Context, controllerContext fac
115115
}
116116

117117
switch authnConfig.Spec.Type {
118-
case "", configv1.AuthenticationTypeIntegratedOAuth:
118+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
119+
case "", configv1.AuthenticationTypeIntegratedOAuth, configv1.AuthenticationTypeNone:
119120
default:
120121
// if we're not using integrated oauth, reset all degraded conditions
121122
statusHandler.AddConditions(status.HandleProgressingOrDegraded("OAuthClientSync", "", nil))

pkg/console/controllers/oauthclientsecret/oauthclientsecret.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ func (c *oauthClientSecretController) sync(ctx context.Context, syncCtx factory.
107107

108108
var secretString string
109109
switch authConfig.Spec.Type {
110-
case "", configv1.AuthenticationTypeIntegratedOAuth:
110+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
111+
case "", configv1.AuthenticationTypeIntegratedOAuth, configv1.AuthenticationTypeNone:
111112
// in OpenShift controlled world, we generate the client secret ourselves
112113
if clientSecret != nil {
113114
secretString = secretsub.GetSecretString(clientSecret)

pkg/console/controllers/util/informers.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ func (s *InformerWithSwitch) sync(ctx context.Context, _ factory.SyncContext) er
123123
}
124124

125125
switch authnConfig.Spec.Type {
126-
case "", configv1.AuthenticationTypeIntegratedOAuth:
126+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
127+
case "", configv1.AuthenticationTypeIntegratedOAuth, configv1.AuthenticationTypeNone:
127128
klog.V(4).Infof("authentication type '%s'; starting OAuth clients informer", authnConfig.Spec.Type)
128129
s.ensureRunning()
129130

130-
case configv1.AuthenticationTypeOIDC, configv1.AuthenticationTypeNone:
131+
case configv1.AuthenticationTypeOIDC:
131132
klog.V(4).Infof("authentication type '%s'; stopping OAuth clients informer", authnConfig.Spec.Type)
132133
s.stop()
133134

pkg/console/controllers/util/informers_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ func TestSync(t *testing.T) {
8383
{"informer running when auth type IntegratedOAuth", configv1.AuthenticationTypeIntegratedOAuth, "cluster", true, false},
8484
{"informer running when auth type empty", configv1.AuthenticationType(""), "cluster", true, false},
8585
{"informer not running when auth type OIDC", configv1.AuthenticationTypeOIDC, "cluster", false, false},
86-
{"informer not running when auth type None", configv1.AuthenticationTypeNone, "cluster", false, false},
86+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
87+
{"informer running when auth type None", configv1.AuthenticationTypeNone, "cluster", true, false},
8788
}
8889

8990
for _, tt := range tests {

pkg/console/operator/sync_v400.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
157157

158158
var oauthServingCertConfigMap *corev1.ConfigMap
159159
switch authnConfig.Spec.Type {
160-
case "", configv1.AuthenticationTypeIntegratedOAuth:
160+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
161+
case "", configv1.AuthenticationTypeIntegratedOAuth, configv1.AuthenticationTypeNone:
161162
var oauthServingCertErrReason string
162163
var oauthServingCertErr error
163164

pkg/console/subresource/consoleserver/config_builder.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,13 @@ func (b *ConsoleServerCLIConfigBuilder) Capabilities(capabilities []operatorv1.C
154154

155155
func (b *ConsoleServerCLIConfigBuilder) AuthConfig(authnConfig *configv1.Authentication, apiServerURL string) *ConsoleServerCLIConfigBuilder {
156156
switch authnConfig.Spec.Type {
157-
case "", configv1.AuthenticationTypeIntegratedOAuth:
157+
// We don't disable auth since the internal OAuth server is not disabled even with auth type 'None'.
158+
case "", configv1.AuthenticationTypeIntegratedOAuth, configv1.AuthenticationTypeNone:
158159
b.authType = "openshift"
159160
b.oauthClientID = api.OAuthClientName
160161
b.CAFile = oauthServingCertFilePath
161162
return b
162163

163-
case configv1.AuthenticationTypeNone:
164-
b.authType = "disabled"
165-
return b
166-
167164
case configv1.AuthenticationTypeOIDC:
168165
if len(authnConfig.Spec.OIDCProviders) == 0 {
169166
b.authType = "disabled"

0 commit comments

Comments
 (0)