Bug 1867848 - Registry returns incorrect properties and dependencies for bundles without any properties or dependencies
Summary: Registry returns incorrect properties and dependencies for bundles without an...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.6.0
Assignee: Ben Luddy
QA Contact: Jian Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-11 01:42 UTC by Ben Luddy
Modified: 2020-10-27 16:27 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 16:27:30 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-registry pull 417 0 None closed Bug 1867848: Return empty properties and dependencies in ListBundles responses. 2020-11-25 09:10:37 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:27:43 UTC

Description Ben Luddy 2020-08-11 01:42:46 UTC
Description of problem:

Responses from the registry "ListBundles" endpoint report {"properties":[{}],...} or {"dependencies":[{}]}, respectively, when a given bundle has no stored properties or dependencies.

Backwards compatibility for bundles that do not specify provided and required GVKs using properties and dependencies is not activated when a bundle reports at least one property or dependency (https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/registry/resolver/operators.go#L259-L273), so dependency resolutions will not recognize the provided or required APIs for older bundles.

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

4.6.0

How reproducible: always

Steps to Reproduce:
1. Extract the database from an image:

$ docker cp $(docker create quay.io/operator-framework/upstream-community-operators):/bundles.db .

2. Serve with opm:

$ opm registry serve -d bundles.db

2. Query the ListBundles endpoint:

$ grpcurl --plaintext localhost:50051 api.Registry/ListBundles | jq '{csvName,dependencies,properties}|select(.properties==[{}] or .dependencies==[{}])'

Actual results:

Many bundles in the response show [{}] for either properties or dependencies.


...
{
  "csvName": "infinispan-operator.v1.0.1",
  "dependencies": [
    {}
  ],
  "properties": [
    {
      "type": "olm.gvk",
      "value": "{\"group\":\"infinispan.org\",\"kind\":\"Infinispan\",\"version\":\"v1\"}"
    },
    {
      "type": "olm.package",
      "value": "{\"packageName\":\"infinispan\",\"version\":\"1.0.1\"}"
    }
  ]
}
...

Expected results:

No bundles in the response should have an empty entry -- {} -- in their dependencies or properties fields. Instead, those fields should be omitted, null, or [].

Comment 4 Jian Zhang 2020-08-18 01:33:17 UTC
[root@preserve-olm-env data]# opm version
Version: version.Version{OpmVersion:"v1.12.5-106-gd724d65", GitCommit:"d724d65", BuildDate:"2020-08-18T01:16:19Z", GoOs:"linux", GoArch:"amd64"}

[root@preserve-olm-env data]# docker cp $(docker create quay.io/operator-framework/upstream-community-operators):/bundles.db .
...

[root@preserve-olm-env data]# opm registry serve -d bundles.db
time="2020-08-17T21:23:01-04:00" level=info msg="Keeping server open for infinite seconds" database=bundles.db port=50051
time="2020-08-17T21:23:01-04:00" level=info msg="serving registry" database=bundles.db port=50051

In another terminal, 
[root@preserve-olm-env data]# grpcurl --plaintext localhost:50051 api.Registry/ListBundles | jq '{csvName,dependencies,properties}'
{
  "csvName": "hive-operator.v1.0.1",
  "dependencies": null,
  "properties": [
    {
      "type": "olm.gvk",
      "value": "{\"group\":\"hive.openshift.io\",\"kind\":\"Checkpoint\",\"version\":\"v1\"}"
    },
...

It returns nothing, LGTM, verify it.
[root@preserve-olm-env data]# grpcurl --plaintext localhost:50051 api.Registry/ListBundles | jq '{csvName,dependencies,properties}|select(.properties==[{}] or .dependencies==[{}])'
[root@preserve-olm-env data]#

Comment 6 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


Note You need to log in before you can comment on or make changes to this bug.