Skip to content

Commit 1eccfe3

Browse files
Merge pull request #444 from RadekManak/feature-ccm-flake-fix
NO-JIRA: fix: report all degraded controller conditions instead of first only#444
2 parents b4e6117 + 099bb22 commit 1eccfe3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/controllers/clusteroperator_controller.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"context"
2121
"crypto/tls"
2222
"fmt"
23+
"sort"
24+
"strings"
2325

2426
configv1 "github.com/openshift/api/config/v1"
2527
operatorv1 "github.com/openshift/api/operator/v1"
@@ -299,11 +301,12 @@ func (r *CloudOperatorReconciler) checkControllerConditions(ctx context.Context)
299301

300302
cloudConfigControllerAvailable := false
301303
trustedCABundleControllerAvailable := false
304+
var degradedMessages []string
302305

303306
for _, cond := range co.Status.Conditions {
304307
if cond.Type == cloudConfigControllerDegradedCondition || cond.Type == trustedCABundleControllerDegradedCondition {
305308
if cond.Status == configv1.ConditionTrue {
306-
return false, fmt.Errorf("failed to apply resources because %s condition is set to True: %s", cond.Type, cond.Message)
309+
degradedMessages = append(degradedMessages, fmt.Sprintf("%s condition is set to True: %s", cond.Type, cond.Message))
307310
}
308311
}
309312

@@ -316,6 +319,11 @@ func (r *CloudOperatorReconciler) checkControllerConditions(ctx context.Context)
316319
}
317320
}
318321

322+
if len(degradedMessages) > 0 {
323+
sort.Strings(degradedMessages)
324+
return false, fmt.Errorf("failed to apply resources because %s", strings.Join(degradedMessages, "; "))
325+
}
326+
319327
return cloudConfigControllerAvailable && trustedCABundleControllerAvailable, nil
320328
}
321329

0 commit comments

Comments
 (0)