Skip to content

Commit f353bfb

Browse files
Merge pull request #5397 from QiWang19/cip-noupgrade-420
OCPBUGS-64822: Implement upgrade blocking for conflicting ClusterImagePolicy named "openshift"
2 parents 0c58628 + 87bdf1f commit f353bfb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/operator/status.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,16 @@ func (optr *Operator) syncUpgradeableStatus(co *configv1.ClusterOperator) error
280280
coStatusCondition.Reason = "ClusterOnCgroupV1"
281281
coStatusCondition.Message = "Cluster is using deprecated cgroup v1 and is not upgradable. Please update the `CgroupMode` in the `nodes.config.openshift.io` object to 'v2'. Once upgraded, the cluster cannot be changed back to cgroup v1"
282282
}
283+
284+
// Check for ClusterImagePolicy named "openshift" which conflicts with the cluster default ClusterImagePolicy object
285+
if _, err = optr.configClient.ConfigV1().ClusterImagePolicies().Get(context.TODO(), "openshift", metav1.GetOptions{}); err == nil {
286+
coStatusCondition.Status = configv1.ConditionFalse
287+
coStatusCondition.Reason = "ConflictingClusterImagePolicy"
288+
coStatusCondition.Message = "ClusterImagePolicy resource named 'openshift' conflicts with the cluster default ClusterImagePolicy object and blocks upgrades. Please delete the 'openshift' ClusterImagePolicy resource and reapply it with a different name if needed"
289+
} else if !apierrors.IsNotFound(err) {
290+
return err
291+
}
292+
283293
var degraded, interrupted bool
284294
for _, pool := range pools {
285295
interrupted = isPoolStatusConditionTrue(pool, mcfgv1.MachineConfigPoolBuildInterrupted)

0 commit comments

Comments
 (0)