Bug 1867821

Summary: Default sources in marketplace are not ranked in order of preference
Product: OpenShift Container Platform Reporter: Anik <anbhatta>
Component: OLMAssignee: Anik <anbhatta>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified    
Version: unspecified   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
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:27:30 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:

Description Anik 2020-08-10 21:42:54 UTC
Description of problem:

The CatalogSource api was enhanced with a spec.priority field (https://github.com/operator-framework/api/pull/49) that is now used for dependency resolution(https://github.com/operator-framework/operator-lifecycle-manager/pull/1706). 

The default sources in marketplace (https://github.com/operator-framework/operator-marketplace/tree/master/defaults) should include the priority field to rank the sources for the dependency resolver. 

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Install an operator that is provided by both redhat-operators and community-operators using the console

Actual results:

The operator installed cannot be predicted to be from either of redhat-operators or community-operators. Repeating step 1 produces different results everytime 

Expected results:

Operator should be installed from the redhat-operators as that catalog should be ranked higher in an OCP cluster. 

Additional info:

Comment 3 Jian Zhang 2020-08-26 10:55:58 UTC
LGTM, veirfy it. Details:
[root@preserve-olm-env data]# oc exec marketplace-operator-6476f45dcb-bt2wq -- marketplace-operator --version
Marketplace source git commit: 0c3267ec28a71f25533bee9f541ae044c5883b69
time="2020-08-26T10:38:31Z" level=info msg="Go Version: go1.14.4"
time="2020-08-26T10:38:31Z" level=info msg="Go OS/Arch: linux/amd64"
time="2020-08-26T10:38:31Z" level=info msg="operator-sdk Version: v0.8.0"

[root@preserve-olm-env data]# oc get catalogsource
NAME                  DISPLAY                TYPE   PUBLISHER      AGE
certified-operators   Certified Operators    grpc   Red Hat        26m
community-operators   Community Operators    grpc   Red Hat        26m
qe-app-registry       Production Operators   grpc   OpenShift QE   9m21s
redhat-marketplace    Red Hat Marketplace    grpc   Red Hat        26m
redhat-operators      Red Hat Operators      grpc   Red Hat        26m

[root@preserve-olm-env data]# oc get catalogsource redhat-operators -o=jsonpath='{.spec.priority}'
-100
[root@preserve-olm-env data]# oc get catalogsource certified-operators -o=jsonpath='{.spec.priority}'
-200
[root@preserve-olm-env data]# oc get catalogsource redhat-marketplace -o=jsonpath='{.spec.priority}'
-300
[root@preserve-olm-env data]# oc get catalogsource community-operators -o=jsonpath='{.spec.priority}'
-400

Comment 5 errata-xmlrpc 2020-10-27 16:27:30 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