Skip to content

Commit d9607d1

Browse files
committed
OCPBUGS-23514: status: Adjust impact summary for Failing=Unknown
[cvo#1165](openshift/cluster-version-operator#1165) introduced uncertainty of the Failing condition (`Failing=Unknown`). This PR adjusts the impact summary in updateInsight accordingly.
1 parent 6de369b commit d9607d1

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

pkg/cli/admin/upgrade/status/controlplane.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,17 @@ func assessControlPlaneStatus(cv *v1.ClusterVersion, operators []v1.ClusterOpera
170170
}
171171
insights = append(insights, insight)
172172
} else if c.Status != v1.ConditionFalse {
173+
verb := "is"
174+
if c.Status == v1.ConditionUnknown {
175+
verb = "may be"
176+
}
173177
insight := updateInsight{
174178
startedAt: c.LastTransitionTime.Time,
175179
scope: updateInsightScope{scopeType: scopeTypeControlPlane, resources: []scopeResource{{kind: cvGroupKind, name: cv.Name}}},
176180
impact: updateInsightImpact{
177181
level: warningImpactLevel,
178182
impactType: updateStalledImpactType,
179-
summary: fmt.Sprintf("Cluster Version %s is failing to proceed with the update (%s)", cv.Name, c.Reason),
183+
summary: fmt.Sprintf("Cluster Version %s %s failing to proceed with the update (%s)", cv.Name, verb, c.Reason),
180184
description: c.Message,
181185
},
182186
remediation: updateInsightRemediation{reference: "https://github.com/openshift/runbooks/blob/master/alerts/cluster-monitoring-operator/ClusterOperatorDegraded.md"},

pkg/cli/admin/upgrade/status/controlplane_test.go

+68
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,74 @@ func TestAssessControlPlaneStatus_Operators(t *testing.T) {
272272
}
273273
}
274274

275+
func TestAssessControlPlaneStatus_insights(t *testing.T) {
276+
testCases := []struct {
277+
name string
278+
cv *configv1.ClusterVersion
279+
expected []updateInsight
280+
}{
281+
{
282+
name: "cv: something went wrong",
283+
cv: &configv1.ClusterVersion{
284+
ObjectMeta: metav1.ObjectMeta{Name: "version"},
285+
Status: configv1.ClusterVersionStatus{
286+
Desired: configv1.Release{Version: "new"},
287+
Conditions: []configv1.ClusterOperatorStatusCondition{{
288+
Type: clusterStatusFailing,
289+
Status: configv1.ConditionTrue,
290+
Reason: "something went wrong",
291+
}},
292+
},
293+
},
294+
expected: []updateInsight{
295+
{
296+
scope: updateInsightScope{scopeType: "ControlPlane", resources: []scopeResource{{kind: scopeGroupKind{group: "config.openshift.io", kind: "ClusterVersion"}, name: "version"}}},
297+
impact: updateInsightImpact{
298+
level: warningImpactLevel,
299+
impactType: "Update Stalled",
300+
summary: "Cluster Version version is failing to proceed with the update (something went wrong)",
301+
},
302+
remediation: updateInsightRemediation{reference: "https://github.com/openshift/runbooks/blob/master/alerts/cluster-monitoring-operator/ClusterOperatorDegraded.md"},
303+
},
304+
},
305+
},
306+
{
307+
name: "cv: SlowClusterOperator",
308+
cv: &configv1.ClusterVersion{
309+
ObjectMeta: metav1.ObjectMeta{Name: "version"},
310+
Status: configv1.ClusterVersionStatus{
311+
Desired: configv1.Release{Version: "new"},
312+
Conditions: []configv1.ClusterOperatorStatusCondition{{
313+
Type: clusterStatusFailing,
314+
Status: configv1.ConditionUnknown,
315+
Reason: "SlowClusterOperator",
316+
}},
317+
},
318+
},
319+
expected: []updateInsight{
320+
{
321+
scope: updateInsightScope{scopeType: "ControlPlane", resources: []scopeResource{{kind: scopeGroupKind{group: "config.openshift.io", kind: "ClusterVersion"}, name: "version"}}},
322+
impact: updateInsightImpact{
323+
level: warningImpactLevel,
324+
impactType: "Update Stalled",
325+
summary: "Cluster Version version may be failing to proceed with the update (SlowClusterOperator)",
326+
},
327+
remediation: updateInsightRemediation{reference: "https://github.com/openshift/runbooks/blob/master/alerts/cluster-monitoring-operator/ClusterOperatorDegraded.md"},
328+
},
329+
},
330+
},
331+
}
332+
333+
for _, tc := range testCases {
334+
t.Run(tc.name, func(t *testing.T) {
335+
_, insights := assessControlPlaneStatus(tc.cv, nil, "", time.Now())
336+
if diff := cmp.Diff(tc.expected, insights, allowUnexportedInsightStructs); diff != "" {
337+
t.Errorf("%s: expected insights differs from actual:\n%s", tc.name, diff)
338+
}
339+
})
340+
}
341+
}
342+
275343
func TestAssessControlPlaneStatus_Estimate(t *testing.T) {
276344
now := time.Now()
277345
minutesAgo := [250]time.Time{}

0 commit comments

Comments
 (0)