diff --git a/pkg/operator2/operator.go b/pkg/operator2/operator.go index 85d0746baf..fa995e94bf 100644 --- a/pkg/operator2/operator.go +++ b/pkg/operator2/operator.go @@ -260,10 +260,11 @@ func (c *authOperator) Sync(obj metav1.Object) error { syncErr := c.handleSync(operatorConfigCopy) // this is a catch all degraded state that we only set when we are otherwise not degraded globalDegradedErr := syncErr - if isDegraded(operatorConfigCopy) { + const globalDegradedPrefix = "OperatorSync" + if isDegradedIgnoreGlobal(operatorConfigCopy, globalDegradedPrefix) { globalDegradedErr = nil // unset because we are already degraded for some other reason } - handleDegraded(operatorConfigCopy, "OperatorSync", globalDegradedErr) + handleDegraded(operatorConfigCopy, globalDegradedPrefix, globalDegradedErr) if _, _, err := v1helpers.UpdateStatus(c.authOperatorConfigClient, func(status *operatorv1.OperatorStatus) error { // store a copy of our starting conditions, we need to preserve last transition time diff --git a/pkg/operator2/status.go b/pkg/operator2/status.go index b9e1f14302..6b47faefa3 100644 --- a/pkg/operator2/status.go +++ b/pkg/operator2/status.go @@ -25,9 +25,11 @@ func handleDegraded(operatorConfig *operatorv1.Authentication, prefix string, er }) } -func isDegraded(operatorConfig *operatorv1.Authentication) bool { +func isDegradedIgnoreGlobal(operatorConfig *operatorv1.Authentication, prefix string) bool { + globalDegraded := prefix + operatorv1.OperatorStatusTypeDegraded for _, condition := range operatorConfig.Status.Conditions { - if strings.HasSuffix(condition.Type, operatorv1.OperatorStatusTypeDegraded) && + if condition.Type != globalDegraded && // we want to know if we are degraded for something other than this + strings.HasSuffix(condition.Type, operatorv1.OperatorStatusTypeDegraded) && condition.Status == operatorv1.ConditionTrue { return true }