Bug 1811142

Summary: Pushing an operator whose default channel points to a non-existent CSV breaks the entire OperatorHub UI
Product: OpenShift Container Platform Reporter: Robb Hamilton <rhamilto>
Component: Management ConsoleAssignee: Robb Hamilton <rhamilto>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4CC: aos-bugs, hasha, jmontleo, jokerman, spadgett, wsun, yapei
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 1809706
: 1826494 (view as bug list) Environment:
Last Closed: 2020-05-04 11:45:08 UTC Type: ---
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: 1809706    
Bug Blocks: 1826494    

Description Robb Hamilton 2020-03-06 17:14:02 UTC
+++ This bug was initially created as a clone of Bug #1809706 +++

Description of problem:
In the process of rebranding our operator I missed updating the name of the currentCSV for the default channel. I pushed the app with operator-courier which did not fail to validate and I ended up breaking OperatorHub completely.

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

How reproducible:
Always

Steps to Reproduce:
1. Install OpenShift 4.1
2. Install an operatorsource pointing at my bad bundle
3. Browse to OperatorHub

Actual results:
OperatorHub is completely broken

Expected results:
operator-courier doesn't validate the bad bundle
OperatorHub doesn't break due to the bad CSV

Additional info:
Knowing it was my operator(source) I looked at the pod and saw the following which led me pretty directly to the problem:
time="2020-03-03T17:34:33Z" level=warning msg="strict mode disabled" error="error loading manifests from appregistry: error loading operator manifests: error loading package into db: [FOREIGN KEY constraint failed, no default channel specified for konveyor-operator]" port=50051 type=appregistry

operator-source with bad bundle:
```
apiVersion: operators.coreos.com/v1
kind: OperatorSource
metadata:
  name: jmontleon-operator
  namespace: openshift-marketplace
spec:
  type: appregistry
  endpoint: https://quay.io/cnr
  registryNamespace: jmontleon
  displayName: "Migration Operator"
  publisher: "ocp-migrate-team"
```

Error in the UI is:
TypeError
Description:

o.a(...) is undefined
Component Trace: 
in OperatorHubList
    in Unknown
    in Unknown
    in x
    in t
    in x
    in div
    in div
    in Unknown
    in t
    in OperatorHubPage
    in t
    in e
    in w
    in e
    in div
    in div
    in section
    in h
    in Unknown
    in x
    in x
    in main
    in div
    in b
    in t
    in e
    in e
    in e

Stack Trace:
g/y<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/operator-hub-chunk-02d8d2277a00b831aae3.min.js:1:18799
g@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/operator-hub-chunk-02d8d2277a00b831aae3.min.js:1:18725
Ra@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:55337
pi@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:62378
Kc@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:99519
Fc@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:84010
Hc@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:81035
Tc@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:79608
po/<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:41759
e.unstable_runWithPriority@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:126:3878
lo@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:41488
po@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:41707
ho@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:41640
Ac@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:118:79935
notify@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:29:47885
i</e.notifyNestedSubs@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:29:47454
f</n.notifySubscribers@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:35:1722366
i</e.handleChangeWrapper@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:29:47522
m@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:12:508121
h/</</<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:122509
dispatch@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/vendors~main-chunk-40fda64599f8ff76fdc8.min.js:12:511620
s/</</<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:101612
s/</<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:101582
c/</<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:98979
c/<@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:99084
i@https://console-openshift-console.apps.jmontleon.migration.redhat.com/static/main-chunk-7cf55c70a0cf82419afb.min.js:1:97825

Comment 4 shahan 2020-04-23 03:12:26 UTC
create the operatorsource with:
# cat operator-source.yaml
apiVersion: operators.coreos.com/v1
kind: OperatorSource
metadata:
  name: jmontleon-operator
  namespace: openshift-marketplace
spec:
  type: appregistry
  endpoint: https://quay.io/cnr
  registryNamespace: jmontleon
  displayName: "Migration Operator"
  publisher: "ocp-migrate-team"

Then goto opeatorhub page, the page will not broken and works well 
4.4.0-0.ci-2020-04-22-145203

Comment 6 errata-xmlrpc 2020-05-04 11:45:08 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-2020:0581