Bug 1693375 - [marketplace] Operator is creating invalid appregistry-server command
Summary: [marketplace] Operator is creating invalid appregistry-server command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.1.0
Assignee: aravindh
QA Contact: Fan Jia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-27 16:47 UTC by Alexander Greene
Modified: 2019-06-04 10:46 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: In the case where a CatalogSourceConfig had packages from two different app registries, the generated command was getting mangled by the time it to got to the registry pod. Consequence: Crashing registry pod Fix: This was fixed creating a list of -r options that was then passed to the registry pod. Result: registry pods don't crash
Clone Of:
Environment:
Last Closed: 2019-06-04 10:46:29 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0758 None None None 2019-06-04 10:46:37 UTC

Description Alexander Greene 2019-03-27 16:47:16 UTC
A bug was introduced[1] that creates an invalid appregistry-server command. The lack of double quotes around the string assigned to `--registry` causes bash to interpret the `|` as a pipe rather than part of the registry string.

Background Information:
A deployment created as a result of a reconciled catalogsourceconfig defines the command that is ran in the pod below:
spec:
```
...
...
containers:
  - command:
    - appregistry-server
    - --registry=https://quay.io/cnr|marketplace_e2e --registry=https://quay.io/cnr|community-operators
    - -o
    - dynatrace,metering,svcat,mongodb,prometheus,amq-streams,clusterlogging,couchbase,descheduler,etcd,federationv2
...
...
```
 
The pod created by this deployment fails when running the command:
```
$ oc logs test-operators-68899b45db-npsnt 

time="2019-03-27T00:57:20Z" level=info msg="Using in-cluster kube client config" port=50051 type=appregistry
time="2019-03-27T00:57:20Z" level=info msg="operator source(s) specified are - [https://quay.io/cnr%7Cmarketplace_e2e --registry=https://quay.io/cnr%7Credhat-operators]" port=50051 type=appregistry
time="2019-03-27T00:57:20Z" level=info msg="package(s) specified are - federationv2,mongodb,svcat,couchbase,dynatrace,descheduler,etcd,metering,prometheus,amq-streams,clusterlogging" port=50051 type=appregistry
time="2019-03-27T00:57:20Z" level=error msg="the following error(s) occurred while parsing input - invalid source, secret specified is malformed - redhat-operators" port=50051 type=appregistry
time="2019-03-27T00:57:20Z" level=info msg="can't proceed, bailing out" port=50051 type=appregistry
time="2019-03-27T00:57:20Z" level=fatal msg="error loading manifest from remote registry - invalid source, secret specified is malformed - redhat-operators" port=50051 type=appregistry
```


Updating this command to include double quotes around the string assigned to `--registry` resolves this issue:
```
$  appregistry-server --registry="https://quay.io/cnr|redhat-operators" --registry="https://quay.io/cnr|marketplace_e2e" -o amq-streams,dynatrace,federationv2,metering,mongodb,prometheus,clusterlogging,couchbase,descheduler,etcd,svcat

time="2019-03-27T16:40:59Z" level=info msg="Using in-cluster kube client config" port=50051 type=appregistry
time="2019-03-27T16:40:59Z" level=info msg="operator source(s) specified are - [https://quay.io/cnr|redhat-operators https://quay.io/cnr|marketplace_e2e]" port=50051 type=appregistry
time="2019-03-27T16:40:59Z" level=info msg="package(s) specified are - amq-streams,dynatrace,federationv2,metering,mongodb,prometheus,clusterlogging,couchbase,descheduler,etcd,svcat" port=50051 type=appregistry
time="2019-03-27T16:40:59Z" level=info msg="input has been sanitized" port=50051 type=appregistry
time="2019-03-27T16:40:59Z" level=info msg="sources: [https://quay.io/cnr/redhat-operators https://quay.io/cnr/marketplace_e2e]" port=50051 type=appregistry
time="2019-03-27T16:40:59Z" level=info msg="packages: [amq-streams dynatrace federationv2 metering mongodb prometheus clusterlogging couchbase descheduler etcd svcat]" port=50051 type=appregistry
time="2019-03-27T16:41:00Z" level=info msg="resolved the following packages: [marketplace_e2e/dynatrace:0.2.0 marketplace_e2e/metering:0.12.0 marketplace_e2e/svcat:0.1.34 redhat-operators/amq-streams:1.0.2 marketplace_e2e/couchbase:1.0.0 marketplace_e2e/descheduler:0.0.1 marketplace_e2e/etcd:0.9.2 marketplace_e2e/federationv2:0.0.2 marketplace_e2e/mongodb:0.3.2 marketplace_e2e/prometheus:0.22.2 marketplace_e2e/clusterlogging:0.0.1]" port=50051 type=appregistry
time="2019-03-27T16:41:00Z" level=info msg="downloading repository: marketplace_e2e/dynatrace:0.2.0 from https://quay.io/cnr" port=50051 type=appregistry

```

[1] https://github.com/operator-framework/operator-marketplace/pull/139/files#diff-ed7d7c72ad9b4816a7ab9a3482c126a2R257

Comment 1 Fan Jia 2019-03-28 02:39:59 UTC
test env:
cv: 4.0.0-0.nightly-2019-03-26-215932
marketplace commit:e274d6b40505e977e12061becf27218f5eb717fb

create registory-server fail if download packages from multiple opsrc server after the pr https://github.com/operator-framework/operator-marketplace/pull/139/files#diff-ed7d7c72ad9b4816a7ab9a3482c126a2R257.

Comment 3 Fan Jia 2019-04-23 01:51:10 UTC
test env:

cv:4.1.0-0.nightly-2019-04-20-080532

marketplace commit:dda43009df60b028e52a1f7debc468de3266de8e

registory commit:a27f5befb52713c0bd52243b33c84330a87573d3

test result:
create registory-server success if download packages from multiple opsrc server.
create a csc with the package from multi opsrc: and the pod command of registory like:
`
Command:
      appregistry-server
      -r
      https://quay.io/cnr|community-operators
      -r
      https://quay.io/cnr|redhat-operators
      -r
      https://quay.io/cnr|jfan
      -o
      etcd,amq-streams,descheduler-test
`

Comment 5 errata-xmlrpc 2019-06-04 10:46:29 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, 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-2019:0758


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