Bug 1739562

Summary: Panic during migration when cluster is in bad state
Product: OpenShift Container Platform Reporter: Kevin Rizza <krizza>
Component: OLMAssignee: Kevin Rizza <krizza>
OLM sub component: OperatorHub QA Contact: Fan Jia <jfan>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: dageoffr
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:35:36 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 Kevin Rizza 2019-08-09 14:14:01 UTC
Description of problem:

In marketplace 4.2, migration code was written to ensure that clusters upgrading from 4.1 to 4.2 would remove their datastore catalog source configs and update any existing subscriptions to point to catalog sources created directly by operator sources.

There is an issue with that migration code (which always runs on startup and checks to see if anything needs to be migrated) where if a subscription that does not have the spec.package field set and points to a catalog source that does not exist, the migration code will throw an unhandled error and the marketplace will panic.

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

How reproducible:
Always

Steps to Reproduce:
1. Create a subscription that does not point to a package:

#oc create testsubscription.yaml
```
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  labels:
    csc-owner-name: installed-test-openshift-marketplace
    csc-owner-namespace: openshift-marketplace
  name: test-operators-ui-created
  namespace: openshift-marketplace
spec:
  channel: alpha
  name: ""
  source: installed-test-openshift-marketplace
  sourceNamespace: openshift-marketplace
```

2. Restart the marketplace operator pod

Actual results:
Marketplace will fail to run the migration code and the pod will crash loop.

Expected results:
Marketplace will be unable to migrate this particular subscription since it is invalid, but it should just ignore it and move on.

Comment 3 errata-xmlrpc 2019-10-16 06:35:36 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