Bug 1818850

Summary: Catalog-operator crashed when a CatalogSource object doesn't have the `address` and `image` fields
Product: OpenShift Container Platform Reporter: Nick Hale <nhale>
Component: OLMAssignee: Nick Hale <nhale>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: urgent    
Priority: urgent CC: jiazha, nhale, pruan, schoudha, tflannag, vlaad, wking
Version: 4.3.z   
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1817833
: 1818851 (view as bug list) Environment:
Last Closed: 2020-05-13 22:01:33 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: 1817833    
Bug Blocks: 1818851    

Comment 3 Jian Zhang 2020-04-14 04:09:16 UTC
[jzhang@dhcp-140-36 ~]$ oc adm release info --commits registry.svc.ci.openshift.org/ocp/release:4.4.0-0.nightly-2020-04-13-113747 |grep lifecycle 
  operator-lifecycle-manager                     https://github.com/operator-framework/operator-lifecycle-manager            2248cc6bea92a03b450e773b84ef8fa924c9c1c9

1, Create an OCP 4.4 within the fixed PR.

mac:~ jianzhang$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.4.0-0.nightly-2020-04-13-113747   True        False         95s     Cluster version is 4.4.0-0.nightly-2020-04-13-113747
mac:~ jianzhang$ oc project openshift-operator-lifecycle-manager
Now using project "openshift-operator-lifecycle-manager" on server "https://api.ci-ln-c6dy6rb-d5d6b.origin-ci-int-aws.dev.rhcloud.com:6443".
mac:~ jianzhang$ oc exec catalog-operator-7ff4f9785f-s5b9d  -- olm --version
OLM version: 0.14.2
git commit: 2248cc6bea92a03b450e773b84ef8fa924c9c1c9

2, Check the default CatalogSource, OLM pods, they worked well.

mac:~ jianzhang$ oc get pods
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-7ff4f9785f-s5b9d   1/1     Running   0          24m
olm-operator-f8db45cdf-qtznw        1/1     Running   0          24m
packageserver-7fc8c9c849-4h5q5      1/1     Running   0          17m
packageserver-7fc8c9c849-xrvlg      1/1     Running   0          17m

mac:~ jianzhang$ oc get pods -n openshift-marketplace
NAME                                    READY   STATUS    RESTARTS   AGE
certified-operators-859bb99dcb-jhk64    1/1     Running   0          15m
community-operators-69578cc8b-bb6x9     1/1     Running   0          15m
marketplace-operator-77c7d4f5f8-4znfr   1/1     Running   0          15m
redhat-marketplace-84c76885fc-zc5xj     1/1     Running   0          15m
redhat-operators-75fb78b64-pf6nb        1/1     Running   0          15m

mac:~ jianzhang$  oc get packagemanifest
NAME                                         CATALOG               AGE
ibm-helm-repo-operator-app                   Certified Operators   15m
skydive-operator                             Community Operators   15m
...

3, Create a CatalogSource object(grpc) without image and address.
mac:~ jianzhang$ cat cs-1817833.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: bug-no-image
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  displayName: Jian Operators
  publisher: jian

mac:~ jianzhang$ oc create -f cs-1817833.yaml 
catalogsource.operators.coreos.com/bug-no-image created

mac:~ jianzhang$ oc get pods -n openshift-marketplace
NAME                                    READY   STATUS    RESTARTS   AGE
certified-operators-859bb99dcb-jhk64    1/1     Running   0          17m
community-operators-69578cc8b-bb6x9     1/1     Running   0          17m
marketplace-operator-77c7d4f5f8-4znfr   1/1     Running   0          17m
redhat-marketplace-84c76885fc-zc5xj     1/1     Running   0          17m
redhat-operators-75fb78b64-pf6nb        1/1     Running   0          17m

mac:~ jianzhang$ oc get catalogsource -n openshift-marketplace
NAME                  DISPLAY               TYPE   PUBLISHER   AGE
bug-no-image          Jian Operators        grpc   jian        38s
certified-operators   Certified Operators   grpc   Red Hat     17m
community-operators   Community Operators   grpc   Red Hat     17m
redhat-marketplace    Red Hat Marketplace   grpc   Red Hat     17m
redhat-operators      Red Hat Operators     grpc   Red Hat     17m

mac:~ jianzhang$ oc get catalogsource -n openshift-marketplace bug-no-image -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  creationTimestamp: "2020-04-14T03:58:42Z"
  generation: 1
  name: bug-no-image
  namespace: openshift-marketplace
  resourceVersion: "24738"
  selfLink: /apis/operators.coreos.com/v1alpha1/namespaces/openshift-marketplace/catalogsources/bug-no-image
  uid: 34800128-a9d3-433b-9aba-a1461e2820e4
spec:
  displayName: Jian Operators
  publisher: jian
  sourceType: grpc
status:
  message: 'image and address unset: at least one must be set for sourcetype: grpc'
  reason: SpecInvalidError

The OLM pods work well and the error message reported, looks good.

4, Create a CatalogSource object(configmap) without image and address.
mac:~ jianzhang$ cat cs-1817833-configmap.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: bug-no-image-cm
  namespace: openshift-marketplace
spec:
  sourceType: configmap
  displayName: Jian Operators
  publisher: jian

mac:~ jianzhang$ oc create -f cs-1817833-configmap.yaml 
catalogsource.operators.coreos.com/bug-no-image-cm created

mac:~ jianzhang$ oc get catalogsource -n openshift-marketplace bug-no-image-cm -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  creationTimestamp: "2020-04-14T04:02:07Z"
  generation: 1
  name: bug-no-image-cm
  namespace: openshift-marketplace
  resourceVersion: "25755"
  selfLink: /apis/operators.coreos.com/v1alpha1/namespaces/openshift-marketplace/catalogsources/bug-no-image-cm
  uid: 3e52032b-6c65-4d46-bebf-e2a26e1ff97a
spec:
  displayName: Jian Operators
  publisher: jian
  sourceType: configmap
status:
  message: 'configmap name unset: must be set for sourcetype: configmap'
  reason: SpecInvalidError

mac:~ jianzhang$ oc get pods
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-7ff4f9785f-s5b9d   1/1     Running   0          32m
olm-operator-f8db45cdf-qtznw        1/1     Running   0          32m
packageserver-7fc8c9c849-4h5q5      1/1     Running   0          25m
packageserver-7fc8c9c849-xrvlg      1/1     Running   0          24m

5, Create a CatalogSource object without image, address, and sourceType.
mac:~ jianzhang$ cat cs-1817833-empty.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: bug-empty
  namespace: openshift-marketplace
spec:
  displayName: Jian Operators
  publisher: jian

mac:~ jianzhang$ oc get catalogsource -n openshift-marketplace bug-empty-image -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  creationTimestamp: "2020-04-14T04:05:44Z"
  generation: 1
  name: bug-empty-image
  namespace: openshift-marketplace
  resourceVersion: "26841"
  selfLink: /apis/operators.coreos.com/v1alpha1/namespaces/openshift-marketplace/catalogsources/bug-empty-image
  uid: 5c2c4890-c80b-40fb-b608-10ec6633547b
spec:
  displayName: Jian Operators
  image: ""
  publisher: jian
  sourceType: ""
status:
  message: 'unknown sourcetype: '
  reason: SpecInvalidError

OLM pods work well and the error message reported, looks good.

6, Install an operator, for example, etcd, it works well.
mac:~ jianzhang$ oc get sub -A
NAMESPACE   NAME   PACKAGE   SOURCE                CHANNEL
default     etcd   etcd      community-operators   singlenamespace-alpha
mac:~ jianzhang$ oc get csv -n default 
NAME                  DISPLAY   VERSION   REPLACES   PHASE
etcdoperator.v0.9.4   etcd      0.9.4                Succeeded
mac:~ jianzhang$ oc get pods -n default 
NAME                            READY   STATUS    RESTARTS   AGE
etcd-operator-744b6c4d8-gjbnq   3/3     Running   0          65s

LGTM, verify it.

Comment 5 errata-xmlrpc 2020-05-13 22:01:33 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