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-48250: MCO CO degrades are stuck on until master pool updates complete #4791

Merged
merged 1 commit into from
Jan 29, 2025
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
19 changes: 19 additions & 0 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ const (
asExpectedReason = "AsExpected"
)

// This function clears a prior CO degrade condition set by a sync function. If the CO is not
// not degraded, or was degraded by another sync function, this will be a no-op.
func (optr *Operator) clearDegradedStatus(co *configv1.ClusterOperator, syncFn string) (*configv1.ClusterOperator, error) {
if cov1helpers.IsStatusConditionFalse(co.Status.Conditions, configv1.OperatorDegraded) {
return co, nil
}
degradedStatusCondition := cov1helpers.FindStatusCondition(co.Status.Conditions, configv1.OperatorDegraded)
if degradedStatusCondition == nil {
return co, nil
}
if degradedStatusCondition.Reason != taskFailed(syncFn) {
return co, nil
}
newCO := co.DeepCopy()
// Clear the degraded by applying an empty sync error object
optr.syncDegradedStatus(newCO, syncError{})
return optr.updateClusterOperatorStatus(co, &newCO.Status, nil)
}

// syncDegradedStatus applies the new condition to the mco's ClusterOperator object.
func (optr *Operator) syncDegradedStatus(co *configv1.ClusterOperator, ierr syncError) {

Expand Down
5 changes: 5 additions & 0 deletions pkg/operator/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ func (optr *Operator) syncAll(syncFuncs []syncFunc) error {
}
break
}
// If there was no sync error for this function, attempt to clear degrade
updatedCO, err = optr.clearDegradedStatus(updatedCO, sf.name)
if err != nil {
return fmt.Errorf("error clearing degraded status: %v", err)
}
}

optr.syncDegradedStatus(updatedCO, syncErr)
Expand Down