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 }