Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-42535: when no type is specified, don't make illegal condition #702

Merged
merged 1 commit into from
Sep 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions pkg/controllers/routercerts/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func (c *routerCertsDomainValidationController) sync(ctx context.Context, syncCt
// set the condition anywhere in sync() to update the controller's degraded condition
var condition operatorv1.OperatorCondition
defer func() {
if len(condition.Type) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about adding a helper function for checking if a condition is empty ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to save a length check? No.

// no change is desired. This happens when the SyncPartialSecret fails
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, in line 123

return
}

_, _, err = v1helpers.UpdateStatus(ctx, c.operatorClient, v1helpers.UpdateConditionFn(condition))
}()

Expand Down
20 changes: 2 additions & 18 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,24 +259,8 @@ func prepareOauthOperator(ctx context.Context, controllerContext *controllercmd.

staleConditions := staleconditions.NewRemoveStaleConditionsController(
[]string{
// condition types removed in 4.8
"OAuthRouteCheckEndpointAccessibleControllerDegraded",
"OAuthRouteCheckEndpointAccessibleControllerAvailable",
"OAuthServiceCheckEndpointAccessibleControllerDegraded",
"OAuthServiceCheckEndpointAccessibleControllerAvailable",
"OAuthServiceEndpointsCheckEndpointAccessibleControllerDegraded",
"OAuthServiceEndpointsCheckEndpointAccessibleControllerAvailable",
"OAuthServerIngressConfigDegraded",
"OAuthServerProxyDegraded",
"OAuthServerRouteDegraded",
"OAuthVersionDeploymentAvailable",
"OAuthVersionDeploymentProgressing",
"OAuthVersionDeploymentDegraded",
"OAuthVersionRouteDegraded",
"OAuthVersionRouteProgressing",
"OAuthVersionRouteAvailable",
"OAuthVersionRouteSecretDegraded",
"OAuthVersionIngressConfigDegraded",
// condition type removed in 4.17.z
"",
},
operatorCtx.operatorClient,
controllerContext.EventRecorder,
Expand Down