Skip to content

Commit 6db9ef4

Browse files
committed
Clean up the condition with type=ImplicitlyEnabled
This commit addresses the issue found in the last round of pre-merge test [1]. This commit could be reverted after maximal 2 releases. (It is alright to keep it too) Assume this PR gets merged to main which is ATM dev branch: 4.20. When the main branches points to 4.22, all the clusters affetecd by the bug (originally 4.19 and 4.20) should be fixed when they are upgraded to 4.20/4.21. Thus any 4.22 cluster should not be affected. [1]. https://issues.redhat.com/browse/OCPBUGS-56114?focusedId=27251461&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-27251461
1 parent 48d0c1c commit 6db9ef4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pkg/cvo/status.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ func filterOutUpdateErrors(errs []error, updateEffect payload.UpdateEffectType)
488488
func setImplicitlyEnabledCapabilitiesCondition(cvStatus *configv1.ClusterVersionStatus, implicitlyEnabled []configv1.ClusterVersionCapability,
489489
now metav1.Time) {
490490

491+
// This is to clean up the condition with type=ImplicitlyEnabled introduced by OCPBUGS-56114
492+
if c := resourcemerge.FindOperatorStatusCondition(cvStatus.Conditions, "ImplicitlyEnabled"); c != nil {
493+
klog.V(2).Infof("Remove the condition with type ImplicitlyEnabled")
494+
resourcemerge.RemoveOperatorStatusCondition(&cvStatus.Conditions, "ImplicitlyEnabled")
495+
}
496+
491497
if len(implicitlyEnabled) > 0 {
492498
message := "The following capabilities could not be disabled: "
493499
caps := make([]string, len(implicitlyEnabled))

pkg/cvo/status_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,11 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
871871
}
872872
for _, c := range combinations {
873873
tc.args.syncWorkerStatus.Reconciling = c.isReconciling
874-
cvStatus := &configv1.ClusterVersionStatus{}
874+
cvStatus := &configv1.ClusterVersionStatus{
875+
Conditions: []configv1.ClusterOperatorStatusCondition{
876+
{Type: "ImplicitlyEnabled", Message: "to be removed"},
877+
},
878+
}
875879
if !c.isHistoryEmpty {
876880
cvStatus.History = []configv1.UpdateHistory{{State: configv1.PartialUpdate}}
877881
}
@@ -891,6 +895,10 @@ func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition(t
891895
t.Errorf("unexpected progressingCondition when Reconciling == %t && isHistoryEmpty == %t\n:%s", c.isReconciling, c.isHistoryEmpty, diff)
892896
}
893897
}
898+
conditionRemoved := resourcemerge.FindOperatorStatusCondition(cvStatus.Conditions, "ImplicitlyEnabled")
899+
if conditionRemoved != nil {
900+
t.Errorf("ImplicitlyEnabled condition should be removed but is still there when Reconciling == %t && isHistoryEmpty == %t", c.isReconciling, c.isHistoryEmpty)
901+
}
894902
}
895903
payload.COUpdateStartTimesRemove("machine-config")
896904
})

0 commit comments

Comments
 (0)