Skip to content

Commit 29527c7

Browse files
committed
block upgrades for conflict non-default ClusterImagePolicy resources
Signed-off-by: Qi Wang <[email protected]>
1 parent 50712a0 commit 29527c7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pkg/operator/status.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,16 @@ func (optr *Operator) syncUpgradeableStatus(co *configv1.ClusterOperator) error
282282
}
283283

284284
// 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"
285+
// Only block upgrades if it's a customer-created resource (not the internal-openshift-hosted default) for 4.20 techpreview ci builds
286+
cip, err := optr.configClient.ConfigV1().ClusterImagePolicies().Get(context.TODO(), "openshift", metav1.GetOptions{})
287+
if err == nil {
288+
annotations := cip.GetAnnotations()
289+
isClusterDefault := annotations != nil && annotations["exclude.release.openshift.io/internal-openshift-hosted"] == "true"
290+
if !isClusterDefault {
291+
coStatusCondition.Status = configv1.ConditionFalse
292+
coStatusCondition.Reason = "ConflictingClusterImagePolicy"
293+
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"
294+
}
289295
} else if !apierrors.IsNotFound(err) {
290296
return err
291297
}

0 commit comments

Comments
 (0)