Bug 1868497

Summary: Subscription without channel does not generate an InstallPlan
Product: OpenShift Container Platform Reporter: Ben Luddy <bluddy>
Component: OLMAssignee: Ben Luddy <bluddy>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high    
Version: 4.6   
Target Milestone: ---   
Target Release: 4.6.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: 2020-10-27 16:28:06 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 Ben Luddy 2020-08-12 21:04:19 UTC
Description of problem:

No InstallPlan is created for a Subscription if the Subscription spec does not set "channel".

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

4.6

How reproducible: always

Steps to Reproduce:

$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
  name: test-namespace
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: test-catalogsource
  namespace: test-namespace
spec:
  sourceType: grpc
  image: quay.io/operator-framework/upstream-community-operators
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: test-operatorgroup
  namespace: test-namespace
spec:
  targetNamespaces: ["test-namespace"]
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: test-subscription
  namespace: test-namespace
spec:
  name: eclipse-che
  source: test-catalogsource
  sourceNamespace: test-namespace
EOF

Actual results: No InstallPlan is created.

$ k get -n test-namespace ip
No resources found

Expected results: An InstallPlan is created.

$ k get -A ip
NAMESPACE        NAME            CSV                   APPROVAL    APPROVED
test-namespace   install-smrd4   eclipse-che.v7.17.0   Automatic   true

Comment 4 Jian Zhang 2020-08-21 03:40:17 UTC
[root@preserve-olm-env data]# oc -n openshift-operator-lifecycle-manager exec catalog-operator-7574bc8948-gx62l -- olm --version
OLM version: 0.16.0
git commit: c3852d57c86707deb80c042c2155ad82c2d9628f

1, Create a CatalogSource object that its default channel is 4.7.

[root@preserve-olm-env data]# cat cs-etcd.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: etcd-test
  namespace: openshift-marketplace
spec:
  displayName: Jian Test
  publisher: Jian
  sourceType: grpc
  image: quay.io/olmqe/etcd-index:0.9.2
  updateStrategy:
    registryPoll:
      interval: 10m
[root@preserve-olm-env data]# oc create -f cs-etcd.yaml 
catalogsource.operators.coreos.com/etcd-test created


[root@preserve-olm-env data]# oc get pods -n openshift-marketplace
NAME                                    READY   STATUS    RESTARTS   AGE
...
etcd-test-qszl4                         1/1     Running   0          3m18s
...
[root@preserve-olm-env data]# oc get catalogsource -n openshift-marketplace
NAME                  DISPLAY                TYPE   PUBLISHER      AGE
...
etcd-test             Jian Test              grpc   Jian           3m35s

2, Create a project called "test" and create a OperatorGroup in it.

[root@preserve-olm-env data]# oc get og
NAME      AGE
test-og   4m7s

3, Subscribe the etcd opertor without setting the channel. The InstallPlan generated, and it works well. Verify it.

[root@preserve-olm-env data]# cat sub-etcd.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: etcd-sub
  namespace: test
spec:
  name: etcd
  source: etcd-test
  sourceNamespace: openshift-marketplace

[root@preserve-olm-env data]# oc get sub
NAME       PACKAGE   SOURCE      CHANNEL
etcd-sub   etcd      etcd-test   
[root@preserve-olm-env data]# oc get ip
NAME            CSV                   APPROVAL    APPROVED
install-68j9s   etcdoperator.v0.9.5   Automatic   true
[root@preserve-olm-env data]# 
[root@preserve-olm-env data]# 
[root@preserve-olm-env data]# oc get csv
NAME                  DISPLAY   VERSION   REPLACES   PHASE
etcdoperator.v0.9.5   etcd      0.9.5                Succeeded
[root@preserve-olm-env data]# oc get pods
NAME                             READY   STATUS    RESTARTS   AGE
etcd-operator-5fdb848f9b-lv4tl   3/3     Running   0          2m43s

Comment 6 errata-xmlrpc 2020-10-27 16:28:06 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 (OpenShift Container Platform 4.6 GA Images), 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:4196