From aecfb0011823f4ae9018b49a1bd8d9ef1c6bb6b5 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Sun, 19 May 2019 16:24:09 -0400 Subject: [PATCH] status: Simplify operator not available status In practice, the output of displaying version operands is redundant and our current use doesn't require it. Since the core output is "we are going to X, these are the things not there yet" also showing "we are going to X, these are the things not there yet A-X,B-X,C-X" makes it harder to understand what is going on. Strip all sub version reporting from cluster operators, and in the future we can improve this if we have a use case. --- pkg/cvo/internal/operatorstatus.go | 22 ---------------------- pkg/cvo/internal/operatorstatus_test.go | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/pkg/cvo/internal/operatorstatus.go b/pkg/cvo/internal/operatorstatus.go index 0fad320195..cda58cd74b 100644 --- a/pkg/cvo/internal/operatorstatus.go +++ b/pkg/cvo/internal/operatorstatus.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "sort" - "strings" "time" "unicode" @@ -137,23 +136,7 @@ func waitForOperatorStatusToBeDone(ctx context.Context, interval time.Duration, } sort.Strings(keys) - var reports []string - for _, op := range keys { - // we do not need to report `operator` version. - if op == "operator" { - continue - } - ver := undone[op] - if len(ver) == 1 { - reports = append(reports, fmt.Sprintf("missing version information for %s", op)) - continue - } - reports = append(reports, fmt.Sprintf("upgrading %s from %s to %s", op, ver[1], ver[0])) - } message := fmt.Sprintf("Cluster operator %s is still updating", actual.Name) - if len(reports) > 0 { - message = fmt.Sprintf("Cluster operator %s is still updating: %s", actual.Name, strings.Join(reports, ", ")) - } lastErr = &payload.UpdateError{ Nested: errors.New(lowerFirst(message)), Reason: "ClusterOperatorNotAvailable", @@ -176,11 +159,6 @@ func waitForOperatorStatusToBeDone(ctx context.Context, interval time.Duration, available = true case condition.Type == configv1.OperatorProgressing && condition.Status == configv1.ConditionFalse: progressing = false - case condition.Type == configv1.ClusterStatusConditionType("Failing"): - if condition.Status == configv1.ConditionFalse { - failing = false - } - failingCondition = condition case condition.Type == configv1.OperatorDegraded: if condition.Status == configv1.ConditionFalse { degradedValue = false diff --git a/pkg/cvo/internal/operatorstatus_test.go b/pkg/cvo/internal/operatorstatus_test.go index 066e11b4a5..4ccbc90aca 100644 --- a/pkg/cvo/internal/operatorstatus_test.go +++ b/pkg/cvo/internal/operatorstatus_test.go @@ -83,9 +83,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: missing version information for operand-1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: missing version information for operand-1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, { @@ -109,9 +109,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: missing version information for operand-1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: missing version information for operand-1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, { @@ -137,9 +137,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: upgrading operand-1 from v0 to v1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: upgrading operand-1 from v0 to v1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, { @@ -165,9 +165,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: upgrading operand-1 from v0 to v1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: upgrading operand-1 from v0 to v1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, { @@ -197,9 +197,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: upgrading operand-1 from v0 to v1, upgrading operand-2 from v0 to v1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: upgrading operand-1 from v0 to v1, upgrading operand-2 from v0 to v1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, { @@ -229,9 +229,9 @@ func Test_waitForOperatorStatusToBeDone(t *testing.T) { }, }, expErr: &payload.UpdateError{ - Nested: fmt.Errorf("cluster operator test-co is still updating: upgrading operand-2 from v0 to v1"), + Nested: fmt.Errorf("cluster operator test-co is still updating"), Reason: "ClusterOperatorNotAvailable", - Message: "Cluster operator test-co is still updating: upgrading operand-2 from v0 to v1", + Message: "Cluster operator test-co is still updating", Name: "test-co", }, }, {