Skip to content

Commit b6995e9

Browse files
committed
OTA-1626: Handle unknown operators
Following up [1], the function `parseClusterOperatorNames` raises up an error if it gets unknown operators which is a result of CVO's producing a malformed message. It leads to a failure associated to component "Cluster Version Operator". [1]. #30269 (comment)
1 parent 87710bd commit b6995e9

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

pkg/monitortests/clusterversionoperator/clusterversionchecker/monitortest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ func (w *monitor) noFailingUnknownCondition(intervals monitorapi.Intervals) []*j
158158

159159
for _, coName := range platformidentification.KnownOperators.List() {
160160
bzComponent := platformidentification.GetBugzillaComponentForOperator(coName)
161-
if bzComponent == "Unknown" {
162-
bzComponent = coName
163-
}
164161
name := fmt.Sprintf("[bz-%v] clusteroperator/%v must complete version change within limited time", bzComponent, coName)
165162
m := 30
166163
if coName == "machine-config" {
@@ -208,6 +205,9 @@ func parseClusterOperatorNames(message string) (sets.Set[string], error) {
208205
ret.Insert(strings.TrimSpace(coName))
209206
}
210207
}
208+
if diff := sets.List(ret.Difference(sets.New[string](platformidentification.KnownOperators.List()...))); len(diff) > 0 {
209+
return nil, fmt.Errorf("found unknown operator names %q from %q", strings.Join(diff, ", "), message)
210+
}
211211
if len(ret) == 0 {
212212
return nil, fmt.Errorf("failed to parse cluster operator names from %q", message)
213213
}

pkg/monitortests/clusterversionoperator/clusterversionchecker/monitortest_test.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func Test_parseClusterOperatorNames(t *testing.T) {
3535
{
3636
name: "one CO timeout",
3737
reason: "SlowClusterOperator",
38-
message: "waiting on co-timeout over 30 minutes which is longer than expected",
39-
expected: sets.New[string]("co-timeout"),
38+
message: "waiting on network over 30 minutes which is longer than expected",
39+
expected: sets.New[string]("network"),
4040
},
4141
{
4242
name: "mco timeout",
@@ -53,20 +53,26 @@ func Test_parseClusterOperatorNames(t *testing.T) {
5353
{
5454
name: "two COs timeout",
5555
reason: "SlowClusterOperator",
56-
message: "waiting on co-timeout, co-bar-timeout over 30 minutes which is longer than expected",
57-
expected: sets.New[string]("co-timeout", "co-bar-timeout"),
56+
message: "waiting on console, network over 30 minutes which is longer than expected",
57+
expected: sets.New[string]("console", "network"),
5858
},
5959
{
6060
name: "one CO and mco timeout",
6161
reason: "SlowClusterOperator",
62-
message: "waiting on co-timeout over 30 minutes and machine-config over 90 minutes which is longer than expected",
63-
expected: sets.New[string]("machine-config", "co-timeout"),
62+
message: "waiting on network over 30 minutes and machine-config over 90 minutes which is longer than expected",
63+
expected: sets.New[string]("machine-config", "network"),
6464
},
6565
{
6666
name: "three COs timeout",
6767
reason: "SlowClusterOperator",
68-
message: "waiting on co-timeout, co-bar-timeout over 30 minutes and machine-config over 90 minutes which is longer than expected",
69-
expected: sets.New[string]("machine-config", "co-timeout", "co-bar-timeout"),
68+
message: "waiting on console, network over 30 minutes and machine-config over 90 minutes which is longer than expected",
69+
expected: sets.New[string]("machine-config", "console", "network"),
70+
},
71+
{
72+
name: "unknown operators",
73+
reason: "SlowClusterOperator",
74+
message: "waiting on unknown, bar, network over 30 minutes and machine-config over 90 minutes which is longer than expected",
75+
expectedErr: fmt.Errorf(`found unknown operator names "bar, unknown" from "changed to Some=Unknown: SlowClusterOperator: waiting on unknown, bar, network over 30 minutes and machine-config over 90 minutes which is longer than expected"`),
7076
},
7177
}
7278

0 commit comments

Comments
 (0)