Bug 1881222

Summary: OLM can fail to recognize and avoid duplicate package installations
Product: OpenShift Container Platform Reporter: Chris Johnson <cdjohnson>
Component: OLMAssignee: Ben Luddy <bluddy>
OLM sub component: OLM QA Contact: Bruno Andrade <bandrade>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: bandrade, bluddy, ecordell, nhale
Version: 4.6Keywords: UpcomingSprint
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:43:44 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:
Embargoed:
Bug Depends On: 1884641    
Bug Blocks:    

Description Chris Johnson 2020-09-21 20:44:06 UTC
Description of problem:
See upstream issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/1772

Version-Release number of selected component (if applicable):
4.6.0-0.nightly-2020-09-17-073141

Comment 2 Ben Luddy 2020-10-01 21:53:45 UTC
This is partially addressed by changes that are already merged for 4.6, but it can still occur with a few tweaks to the test setup. Posted a PR just now to address that as well.

Repro steps:

===

$ cat << EOF kubectl create -f -
---
apiVersion: v1
kind: Namespace
metadata:
  name: test-namespace
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: test-catalogsource
  namespace: test-namespace
spec:
  image: quay.io/bluddy/foo:catalog-1881222
  sourceType: grpc
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: operatorgroup
  namespace: test-namespace
spec:
  targetNamespaces:
  - test-namespace
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: testoperatorb
  namespace: test-namespace
spec:
  channel: v4.0
  installPlanApproval: Automatic
  name: testoperatorb
  source: test-catalogsource
  sourceNamespace: test-namespace
EOF

namespace/test-namespace created
catalogsource.operators.coreos.com/test-catalogsource created
operatorgroup.operators.coreos.com/operatorgroup created
subscription.operators.coreos.com/testoperatorb created

... wait ...

$ kubectl -n test-namespace get sub

NAME                                                   PACKAGE         SOURCE               CHANNEL
testoperatora-v1.2-test-catalogsource-test-namespace   testoperatora   test-catalogsource   v1.2
testoperatorb                                          testoperatorb   test-catalogsource   v4.0

$ kubectl -n test-namespace patch sub testoperatorb --type=merge -p '{"spec":{"channel":"v4.1-eus"}}'

subscription.operators.coreos.com/testoperatorb patched

... wait ...

$ kubectl -n test-namespace get sub

NAME                                                       PACKAGE         SOURCE               CHANNEL
testoperatora-v1.1-eus-test-catalogsource-test-namespace   testoperatora   test-catalogsource   v1.1-eus
testoperatora-v1.2-test-catalogsource-test-namespace       testoperatora   test-catalogsource   v1.2
testoperatorb                                              testoperatorb   test-catalogsource   v4.1-eus

===

With this issue fixed, the last list of subscriptions should look like this:

NAME                                                   PACKAGE         SOURCE               CHANNEL
testoperatora-v1.2-test-catalogsource-test-namespace   testoperatora   test-catalogsource   v1.2
testoperatorb                                          testoperatorb   test-catalogsource   v4.1-eus

and testoperator b should still be satisfied by v4.0.1:

$ kubectl -n test-namespace get sub testoperatorb -o jsonpath='{.status.installedCSV}'
testoperatorb.v4.0.1

Please ignore if one of the test operators crashes on startup, which may result in a CSV (appropriately) showing phase Installing. These aren't intended to be functional operators, only to test dependency resolution behavior.

Comment 10 errata-xmlrpc 2020-10-27 16:43:44 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.6 GA Images), 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-2020:4196