Skip to content
Merged
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
10 changes: 9 additions & 1 deletion pkg/controllers/clusteroperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
}
}

Expand All @@ -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
}

Expand Down