Bug 1741799

Summary: The InstallPlan `source` field should NOT be empty
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: OLMAssignee: Kevin Rizza <krizza>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: bandrade, chezhang, chuo, jfan, jpeeler, scolange, xjiang
Version: 4.2.0   
Target Milestone: ---   
Target Release: 4.2.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: 2019-10-16 06:36:19 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:

Description Jian Zhang 2019-08-16 06:51:05 UTC
Description of problem:
The `source` of InstallPlan fields are empty. Like below:
mac:~ jianzhang$ oc get ip -n openshift-operators
NAME            CSV                               SOURCE   APPROVAL    APPROVED
install-cpnnw   etcdoperator.v0.9.2                        Automatic   true
install-lkp4j   etcdoperator.v0.9.4-clusterwide            Automatic   true
install-n2cdx   kubefed-operator.v4.2.0                    Automatic   true

Version-Release number of selected component (if applicable):
Cluster version:  4.2.0-0.nightly-2019-08-13-183722 
mac:~ jianzhang$ oc exec catalog-operator-5cc66dd5c4-jjjff  -- olm --version
OLM version: 0.11.0
git commit: 586e941bd1f42ea1f331453ed431fb43699fef70

How reproducible:
always

Steps to Reproduce:
1. Install OCP 4.2, install an operator, for example, etcd.
2. Check its InstallPlan field.

Actual results:
No `source` values, see below:
mac:~ jianzhang$ oc get ip -n openshift-operators
NAME            CSV                               SOURCE   APPROVAL    APPROVED
install-cpnnw   etcdoperator.v0.9.2                        Automatic   true
install-lkp4j   etcdoperator.v0.9.4-clusterwide            Automatic   true
install-n2cdx   kubefed-operator.v4.2.0                    Automatic   true

mac:~ jianzhang$ oc get ip -n openshift-operators install-lkp4j -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: InstallPlan
...
spec:
  approval: Automatic
  approved: true
  clusterServiceVersionNames:
  - etcdoperator.v0.9.4-clusterwide
  source: ""
  sourceNamespace: ""


Expected results:
As the definition in https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/api/apis/operators/v1alpha1/installplan_types.go#L25, 
The `source` means the `CatalogSource`. We should fill in relevant values in it.
And, I highly suggest that we replace this `source` string with `catalogsource`, it more clear.

Additional info:

Comment 1 Evan Cordell 2019-08-21 17:09:52 UTC
> The `source` means the `CatalogSource`. We should fill in relevant values in it.

This is an older part of the API when an installplan was used to install from a single catalog only. Now that we install from multiple catalogs, it doesn't make sense to reference a single catalogsource.

I think that a simpler solution would be to mark these fields as optional, so that they don't show up in the yaml if they're not set.

Comment 5 Jian Zhang 2019-08-30 02:17:42 UTC
OK, remove the 'SOURCE' column and ignore the 'source'/'sourceNamespace' fields. LGTM, verify it. Details as below:

Cluster version is 4.2.0-0.nightly-2019-08-29-041601
mac:~ jianzhang$ oc exec catalog-operator-6f8bbc4c7b-jfpxk -- olm --version
OLM version: 0.11.0
git commit: 02c3e06da1630e53817cb5df4aaf6f270a05ba2e

1, Install OCP 4.2
2, Subscribe an operator, for example, etcd
3, Check its InstallPlan object.

mac:~ jianzhang$ oc get sub -n openshift-operators
NAME   PACKAGE   SOURCE                CHANNEL
etcd   etcd      community-operators   clusterwide-alpha

1, The 'SOURCE' column has been removed.
mac:~ jianzhang$ oc get ip -n openshift-operators
NAME            CSV                               APPROVAL    APPROVED
install-5cmqv   etcdoperator.v0.9.4-clusterwide   Automatic   true

mac:~ jianzhang$ oc get csv -n openshift-operators
NAME                              DISPLAY   VERSION             REPLACES                          PHASE
etcdoperator.v0.9.4-clusterwide   etcd      0.9.4-clusterwide   etcdoperator.v0.9.2-clusterwide   Succeeded

2, The 'source'/'sourceNamespace' fields has been ignored.
mac:~ jianzhang$ oc get ip -n openshift-operators install-5cmqv -o yaml
...
spec:
  approval: Automatic
  approved: true
  clusterServiceVersionNames:
  - etcdoperator.v0.9.4-clusterwide
status:
  catalogSources:
  - community-operators
...

Comment 6 errata-xmlrpc 2019-10-16 06:36:19 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:2922