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
2 changes: 1 addition & 1 deletion pkg/console/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func NewConsoleOperator(
factory.NamesFilter(api.OAuthClientName),
oauthClientSwitchedInformer.Informer(),
).WithFilteredEventsInformers(
util.IncludeNamesFilter(deployment.ConsoleOauthConfigName),
util.IncludeNamesFilter(deployment.ConsoleOauthConfigName, api.ConsoleServingCertName),
secretsInformer.Informer(),
).WithFilteredEventsInformers(
util.IncludeNamesFilter(telemetry.TelemetryConfigMapName),
Expand Down
9 changes: 9 additions & 0 deletions pkg/console/operator/sync_v400.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
return statusHandler.FlushAndReturn(secErr)
}

consoleServingCertSecret, servingCertErr := co.secretsLister.Secrets(api.TargetNamespace).Get(api.ConsoleServingCertName)
statusHandler.AddConditions(status.HandleProgressingOrDegraded("ConsoleServingCertSecretGet", "FailedGet", servingCertErr))
if servingCertErr != nil {
return statusHandler.FlushAndReturn(servingCertErr)
}

actualDeployment, depChanged, depErrReason, depErr := co.SyncDeployment(
ctx,
set.Operator,
Expand All @@ -186,6 +192,7 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
trustedCAConfigMap,
clientSecret,
sessionSecret,
consoleServingCertSecret,
set.Proxy,
set.Infrastructure,
controllerContext.Recorder(),
Expand Down Expand Up @@ -289,6 +296,7 @@ func (co *consoleOperator) SyncDeployment(
trustedCAConfigMap *corev1.ConfigMap,
sec *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
recorder events.Recorder,
Expand All @@ -303,6 +311,7 @@ func (co *consoleOperator) SyncDeployment(
trustedCAConfigMap,
sec,
sessionSecret,
consoleServingCertSecret,
proxyConfig,
infrastructureConfig,
)
Expand Down
6 changes: 6 additions & 0 deletions pkg/console/subresource/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
authnConfigVersionAnnotation = "console.openshift.io/authentication-config-version"
authnCATrustConfigMapResourceVersionAnnotation = "console.openshift.io/authn-ca-trust-config-version"
sessionSecretRVAnnotation = "console.openshift.io/session-secret-version"
servingCertSecretResourceVersionAnnotation = "console.openshift.io/serving-cert-secret-version"
)

var (
Expand All @@ -51,6 +52,7 @@ var (
trustedCAConfigMapResourceVersionAnnotation,
secretResourceVersionAnnotation,
consoleImageAnnotation,
servingCertSecretResourceVersionAnnotation,
}
)

Expand All @@ -73,6 +75,7 @@ func DefaultDeployment(
trustedCAConfigMap *corev1.ConfigMap,
oAuthClientSecret *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
) *appsv1.Deployment {
Expand All @@ -93,6 +96,7 @@ func DefaultDeployment(
trustedCAConfigMap,
oAuthClientSecret,
sessionSecret,
consoleServingCertSecret,
proxyConfig,
infrastructureConfig,
)
Expand Down Expand Up @@ -200,6 +204,7 @@ func withConsoleAnnotations(
trustedCAConfigMap *corev1.ConfigMap,
oAuthClientSecret *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
) {
Expand All @@ -211,6 +216,7 @@ func withConsoleAnnotations(
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
}

if authServerCAConfigMap != nil {
Expand Down
70 changes: 44 additions & 26 deletions pkg/console/subresource/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestDefaultDeployment(t *testing.T) {
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
}
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestDefaultDeployment(t *testing.T) {
proxyConfigResourceVersionAnnotation: "",
infrastructureConfigResourceVersionAnnotation: "",
consoleImageAnnotation: "",
servingCertSecretResourceVersionAnnotation: "",
},
OwnerReferences: []metav1.OwnerReference{{
APIVersion: "operator.openshift.io/v1",
Expand Down Expand Up @@ -136,6 +138,7 @@ func TestDefaultDeployment(t *testing.T) {
proxyConfigResourceVersionAnnotation: "",
infrastructureConfigResourceVersionAnnotation: "",
consoleImageAnnotation: "",
servingCertSecretResourceVersionAnnotation: "",
workloadManagementAnnotation: workloadManagementAnnotationValue,
requiredSCCAnnotation: "restricted-v2",
}
Expand Down Expand Up @@ -213,8 +216,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -292,8 +296,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -370,8 +375,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigSingleReplica,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigSingleReplica,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -441,8 +447,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigExternalTopologyMode,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigExternalTopologyMode,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -514,6 +521,7 @@ func TestDefaultDeployment(t *testing.T) {
tt.args.trustedCAConfigMap,
tt.args.oAuthClientSecret,
tt.args.sessionSecret,
tt.args.consoleServingCertSecret,
tt.args.proxyConfig,
tt.args.infrastructureConfig,
), tt.want); diff != nil {
Expand All @@ -525,16 +533,17 @@ func TestDefaultDeployment(t *testing.T) {

func TestWithConsoleAnnotations(t *testing.T) {
type args struct {
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
}
Comment on lines 535 to 547
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 27, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove unused authnConfig field from test args.

authnConfig (Line 546) is never referenced and is flagged by golangci-lint as unused.

🧹 Proposed fix
 type args struct {
 	deployment               *appsv1.Deployment
 	consoleConfigMap         *corev1.ConfigMap
 	serviceCAConfigMap       *corev1.ConfigMap
 	authServerCAConfigMap    *corev1.ConfigMap
 	trustedCAConfigMap       *corev1.ConfigMap
 	oAuthClientSecret        *corev1.Secret
 	sessionSecret            *corev1.Secret
 	consoleServingCertSecret *corev1.Secret
 	proxyConfig              *configv1.Proxy
 	infrastructureConfig     *configv1.Infrastructure
-	authnConfig              *configv1.Authentication
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type args struct {
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
}
type args struct {
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
}
🧰 Tools
🪛 golangci-lint (2.11.4)

[error] 546-546: field authnConfig is unused

(unused)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/console/subresource/deployment/deployment_test.go` around lines 535 -
547, The test's args struct declares an unused field authnConfig; remove the
authnConfig field from the type args declaration and any test case literals that
set authnConfig so the struct and its usages no longer reference it (look for
the type args declaration and test case constructions in deployment_test.go,
e.g., where an args literal is created) to satisfy golangci-lint's unused-field
complaint.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit, and it is in the test file, not a big deal tho

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Leo6Leo, agreed — it's a minor cosmetic issue in a test file with no functional impact. Feel free to leave it as-is if it's not worth the churn.


consoleConfigMap := &corev1.ConfigMap{
Expand Down Expand Up @@ -584,6 +593,12 @@ func TestWithConsoleAnnotations(t *testing.T) {
},
}

consoleServingCertSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "202020",
},
}

tests := []struct {
name string
args args
Expand All @@ -606,13 +621,14 @@ func TestWithConsoleAnnotations(t *testing.T) {
},
},
},
consoleConfigMap: consoleConfigMap,
serviceCAConfigMap: serviceCAConfigMap,
authServerCAConfigMap: oauthServingCertConfigMap,
trustedCAConfigMap: trustedCAConfigMap,
oAuthClientSecret: oAuthClientSecret,
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfig,
consoleConfigMap: consoleConfigMap,
serviceCAConfigMap: serviceCAConfigMap,
authServerCAConfigMap: oauthServingCertConfigMap,
trustedCAConfigMap: trustedCAConfigMap,
oAuthClientSecret: oAuthClientSecret,
consoleServingCertSecret: consoleServingCertSecret,
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfig,
},
want: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -625,6 +641,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
},
},
Spec: appsv1.DeploymentSpec{
Expand All @@ -640,6 +657,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
},
},
},
Expand All @@ -649,7 +667,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
withConsoleAnnotations(tt.args.deployment, tt.args.consoleConfigMap, tt.args.serviceCAConfigMap, tt.args.authServerCAConfigMap, tt.args.trustedCAConfigMap, tt.args.oAuthClientSecret, tt.args.sessionSecret, tt.args.proxyConfig, tt.args.infrastructureConfig)
withConsoleAnnotations(tt.args.deployment, tt.args.consoleConfigMap, tt.args.serviceCAConfigMap, tt.args.authServerCAConfigMap, tt.args.trustedCAConfigMap, tt.args.oAuthClientSecret, tt.args.sessionSecret, tt.args.consoleServingCertSecret, tt.args.proxyConfig, tt.args.infrastructureConfig)
if diff := deep.Equal(tt.args.deployment, tt.want); diff != nil {
t.Error(diff)
}
Expand Down