+++ This bug was initially created as a clone of Bug #1932002 +++ +++ This bug was initially created as a clone of Bug #1932001 +++ Description of problem: In dependency resolution, Subscription uniqueness is currently based on the subscribed package name. If two Subscriptions in a namespace subscribe to the same package, they are treated as a single Subscription internally, resulting in some surprising behaviors. Version-Release number of selected component (if applicable): 4.6 How reproducible: Always Steps to Reproduce: 1. Subscribe to an operator: $ cat << EOF | kubectl create -f- apiVersion: v1 kind: Namespace metadata: name: test-namespace --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: test-operatorgroup namespace: test-namespace spec: targetNamespaces: - test-namespace --- apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: test-catalog namespace: test-namespace spec: displayName: Community Operators image: quay.io/operatorhubio/catalog:latest sourceType: grpc --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: test-subscription-stable namespace: test-namespace spec: name: redis-operator source: test-catalog sourceNamespace: test-namespace channel: stable startingCSV: redis-operator.v0.4.0 EOF namespace/test-namespace created operatorgroup.operators.coreos.com/test-operatorgroup created catalogsource.operators.coreos.com/test-catalog created subscription.operators.coreos.com/test-subscription-stable created 2. Wait for the operator to be installed: $ kubectl -n test-namespace get csv -w NAME DISPLAY VERSION REPLACES PHASE redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 Pending redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 InstallReady redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 Installing redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 Installing redis-operator.v0.4.0 Redis Operator 0.4.0 redis-operator.v0.3.0 Succeeded 3. Create a conflicting subscription to the same package: $ cat << EOF | kubectl create -f- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: test-subscription-alpha namespace: test-namespace spec: name: redis-operator source: test-catalog sourceNamespace: test-namespace channel: alpha startingCSV: redis-operator.v0.0.1 EOF subscription.operators.coreos.com/test-subscription-alpha created Expected results: Resolution should warn about a conflict between the installed v0.4.0 CSV and the requested v0.0.1 operator from the same package, something like this: $ kubectl logs -n openshift-operator-lifecycle-manager deploy/catalog-operator | grep ResolutionFailed | tail -1 I0223 18:08:32.095488 1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"test-namespace", UID:"59f61254-01b3-4309-9ecc-3ff29f1d979f", APIVersion:"v1", ResourceVersion:"851", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: subscription test-subscription-stable requires @existing/test-namespace//redis-operator.v0.4.0, subscription test-subscription-stable exists, subscription test-subscription-alpha requires test-catalog/test-namespace/alpha/redis-operator.v0.0.1, subscription test-subscription-alpha exists, @existing/test-namespace//redis-operator.v0.4.0 and test-catalog/test-namespace/alpha/redis-operator.v0.0.1 originate from package redis-operator Actual results: The conflict between the two subscriptions is not indicated in the catalog-operator log. There may be some warnings that occur before the CatalogSource becomes available. Those would not indicate that there are two subscriptions to the redis-operator package, and may look something like this: $ kubectl logs -n openshift-operator-lifecycle-manager deploy/catalog-operator | grep ResolutionFailed | tail -1 I0223 18:03:02.611310 1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"test-namespace", UID:"27194bfe-65ee-4d24-86b0-6384fb6fb1a6", APIVersion:"v1", ResourceVersion:"855", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: no operators found matching the subscription criteria for redis-operator, a subscription to package redis-operator exists in the namespace --- Additional comment from Ben Luddy on 2021-02-23 18:26:41 UTC --- A patch for this already merged into release-4.8 (https://github.com/operator-framework/operator-lifecycle-manager/pull/2005), but before this BZ was created. --- Additional comment from Ben Luddy on 2021-03-01 17:26:15 UTC --- Increasing priority to high because a backport of a high priority issue depends on this.
Followed the above kubectl logs -n openshift-operator-lifecycle-manager deploy/catalog-operator | grep ResolutionFailed | tail -1 I0315 13:22:57.887039 1 event.go:278] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"test-namespace", UID:"8e1d999a-fa0d-414e-90d6-8fe188754c97", APIVersion:"v1", ResourceVersion:"39669", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: subscription test-subscription-alpha exists, @existing/test-namespace//redis-operator.v0.4.0 and test-catalog/test-namespace/alpha/redis-operator.v0.0.1 originate from package redis-operator, subscription test-subscription-stable requires @existing/test-namespace//redis-operator.v0.4.0, subscription test-subscription-stable exists, subscription test-subscription-alpha requires test-catalog/test-namespace/alpha/redis-operator.v0.0.1 oc version Client Version: 4.6.0-202103130248.p0-aaa9ca3 Server Version: 4.6.0-0.nightly-2021-03-13-204449 Kubernetes Version: v1.19.0+d46d32f
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.6.22 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:0825