Bug 1979525

Summary: OLM should block the OCP 4.8 upgrade to 4.9 when the operator installed with `olm.openShiftMaxVersion` annotation
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: OLMAssignee: Nick Hale <nhale>
OLM sub component: OLM QA Contact: Bruno Andrade <bandrade>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: dmesser
Version: 4.8   
Target Milestone: ---   
Target Release: 4.8.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1982274 (view as bug list) Environment:
Last Closed: 2021-08-03 06:09:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1982274    
Bug Blocks:    

Comment 8 Bruno Andrade 2021-07-28 21:25:01 UTC
4.8.0-0.nightly-2021-07-28-153234
OLM version: 0.17.0
git commit: e1ceb8eecd87e1ace272b18b2041a191b8e91533

cat cs.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: bug-operators
  namespace: openshift-marketplace
spec:
  displayName: Bug Operators
  image: quay.io/olmqe/deprecated:api
  priority: -100
  publisher: Bug
  sourceType: grpc
  updateStrategy:
    registryPoll:
      interval: 10m0s

oc create -f cs.yaml                                                                                                                                                                                                                  
     catalogsource.operators.coreos.com/bug-operators created

oc create -f og.yaml
     operatorgroup.operators.coreos.com/default-og created

cat sub-deprecatedAPI.yaml 
     apiVersion: operators.coreos.com/v1alpha1
     kind: Subscription
     metadata:
       name: datagrid
       namespace: default
     spec:
       channel: 8.2.x
       installPlanApproval: Automatic
       name: datagrid
       source: bug-operators
       sourceNamespace: openshift-marketplace
       startingCSV: datagrid-operator.v8.2.0

oc get csv -n default
     NAME                       DISPLAY     VERSION   REPLACES                   PHASE
     datagrid-operator.v8.2.0   Data Grid   8.2.0     datagrid-operator.v8.1.7   Succeeded

oc get events --sort-by='.lastTimestamp' | grep -i AppliedWithWarnings                                                                                                                                                                1 ↵
     5m          Warning   AppliedWithWarnings                          installplan/install-qz7mt                              1 warning(s) generated during installation of operator "datagrid-operator.v8.2.0" (CustomResourceDefinition "restores.infinispan.org"): apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
     5m          Warning   AppliedWithWarnings                          installplan/install-qz7mt                              1 warning(s) generated during installation of operator "datagrid-operator.v8.2.0" (CustomResourceDefinition "infinispans.infinispan.org"): apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
     5m          Warning   AppliedWithWarnings                          installplan/install-qz7mt                              1 warning(s) generated during installation of operator "datagrid-operator.v8.2.0" (CustomResourceDefinition "caches.infinispan.org"): apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
     5m          Warning   AppliedWithWarnings                          installplan/install-qz7mt                              1 warning(s) generated during installation of operator "datagrid-operator.v8.2.0" (CustomResourceDefinition "batches.infinispan.org"): apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
     5m          Warning   AppliedWithWarnings                          installplan/install-qz7mt                              1 warning(s) generated during installation of operator "datagrid-operator.v8.2.0" (CustomResourceDefinition "backups.infinispan.org"): apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition

oc get csv -n default datagrid-operator.v8.2.0 -o yaml|grep maxOpenShiftVersion
         operatorframework.io/properties: '{"properties":[{"type":"olm.gvk","value":{"group":"infinispan.org","kind":"Backup","version":"v2alpha1"}},{"type":"olm.gvk","value":{"group":"infinispan.org","kind":"Batch","version":"v2alpha1"}},{"type":"olm.gvk","value":{"group":"infinispan.org","kind":"Cache","version":"v2alpha1"}},{"type":"olm.gvk","value":{"group":"infinispan.org","kind":"Infinispan","version":"v1"}},{"type":"olm.gvk","value":{"group":"infinispan.org","kind":"Restore","version":"v2alpha1"}},{"type":"olm.maxOpenShiftVersion","value":4.8},{"type":"olm.package","value":{"packageName":"datagrid","version":"8.2.0"}}]}'

oc patch clusterversion/version --patch '{"spec":{"upstream":"https://openshift-release.apps.ci.l2s4.p1.openshiftapps.com/graph"}}' --type=merge
         clusterversion.config.openshift.io/version patched

oc patch clusterversion/version --patch '{"spec":{"channel":"nightly-4.9"}}' --type=merge
         clusterversion.config.openshift.io/version patched

User is warned about the compatibility of the deprecated operator. Marking as VERIFIED

oc adm upgrade
        Cluster version is 4.8.0-0.nightly-2021-07-28-153234

        Upgradeable=False

          Reason: IncompatibleOperatorsInstalled
          Message: Cluster operator operator-lifecycle-manager cannot be upgraded between minor versions: The following operators block OpenShift upgrades: Operator datagrid-operator.v8.2.0 in namespace default is not compatible with OpenShift versions greater than 4.8.0

        No updates available. You may force an upgrade to a specific release image, but doing so may not be supported and result in downtime or data loss.

Comment 10 errata-xmlrpc 2021-08-03 06:09:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.8.3 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:2896