From 099bb22eb9c8e34a3f77a17d67b96f6f89b491bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Ma=C5=88=C3=A1k?= Date: Fri, 10 Apr 2026 16:07:42 +0200 Subject: [PATCH] fix: report all degraded controller conditions instead of first only checkControllerConditions() was returning early on the first degraded condition it encountered, so when multiple controllers were degraded simultaneously only one would be reflected in the operator's Degraded status message. Collect all degraded conditions and report them together. --- pkg/controllers/clusteroperator_controller.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/clusteroperator_controller.go b/pkg/controllers/clusteroperator_controller.go index 3b103a0b7..d31c0c3b9 100644 --- a/pkg/controllers/clusteroperator_controller.go +++ b/pkg/controllers/clusteroperator_controller.go @@ -19,6 +19,8 @@ package controllers import ( "context" "fmt" + "sort" + "strings" configv1 "github.com/openshift/api/config/v1" operatorv1 "github.com/openshift/api/operator/v1" @@ -302,11 +304,12 @@ func (r *CloudOperatorReconciler) checkControllerConditions(ctx context.Context) cloudConfigControllerAvailable := false trustedCABundleControllerAvailable := false + var degradedMessages []string for _, cond := range co.Status.Conditions { if cond.Type == cloudConfigControllerDegradedCondition || cond.Type == trustedCABundleControllerDegradedCondition { if cond.Status == configv1.ConditionTrue { - return false, fmt.Errorf("failed to apply resources because %s condition is set to True: %s", cond.Type, cond.Message) + degradedMessages = append(degradedMessages, fmt.Sprintf("%s condition is set to True: %s", cond.Type, cond.Message)) } } @@ -319,6 +322,11 @@ func (r *CloudOperatorReconciler) checkControllerConditions(ctx context.Context) } } + if len(degradedMessages) > 0 { + sort.Strings(degradedMessages) + return false, fmt.Errorf("failed to apply resources because %s", strings.Join(degradedMessages, "; ")) + } + return cloudConfigControllerAvailable && trustedCABundleControllerAvailable, nil }