Bug 1829735

Summary: the condition of csv component listed via operator resource is not correct
Product: OpenShift Container Platform Reporter: kuiwang
Component: OLMAssignee: Nick Hale <nhale>
OLM sub component: OLM QA Contact: kuiwang
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: bandrade, bluddy, jiazha, krizza, nhale, scolange, tbuskey, yhui
Version: 4.5   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 15:58:32 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 kuiwang 2020-04-30 08:33:48 UTC
Description of problem:
we want to view the component via operator resource, but the csv resource is not correctly listed for condition.
for example,
the condition from csv object:
--
- lastTransitionTime: "2020-04-30T07:05:13Z"
    lastUpdateTime: "2020-04-30T07:05:13Z"
    message: all requirements found, attempting install
    phase: InstallReady
    reason: AllRequirementsMet
--

but the condition via operator resource is the the following:
--
- lastTransitionTime: "2020-04-30T07:05:13Z"
        lastUpdateTime: "2020-04-30T07:05:13Z"
        message: all requirements found, attempting install
        reason: AllRequirementsMet
        status: ""
        type: ""
--
the phase is missed, and no information for status and type.

Version-Release number of selected component (if applicable):
kuiwang@Kuis-MacBook-Pro OCP-29666 % oc exec olm-operator-8856b4647-9s48g -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.14.2
git commit: 15f5ba3e984f0f06abfbc6d9d3a38c3f659d2e60


How reproducible:


Steps to Reproduce:
1. enable v2alpha1
1) Follow https://github.com/kuiwang02/cluster-version-operator/blob/master/docs/dev/clusterversion.md  to disable CVO’s reconciliation of OLM operator
   oc project openshift-cluster-version
   cat <<EOF >version-patch-first-override.yaml
- op: add
  path: /spec/overrides
  value:
  - kind: Deployment
    group: apps/v1
    name: olm-operator
    namespace: openshift-operator-lifecycle-manager
    unmanaged: true
    EOF
    oc patch clusterversion version --type json -p "$(cat version-patch-first-override.yaml)"

    2) add the --feature-gates=OperatorLifecycleManagerV2 option to the olm-operator Deployment
    oc project openshift-operator-lifecycle-manager
    oc edit deployment olm-operator
- args:
        - --namespace
        - $(OPERATOR_NAMESPACE)
        - --writeStatusName
        - operator-lifecycle-manager
        - --writePackageServerStatusName
        - operator-lifecycle-manager-packageserver
        - --tls-cert
        - /var/run/secrets/serving-cert/tls.crt
        - --tls-key
        - /var/run/secrets/serving-cert/tls.key
        - --feature-gates
        - OperatorLifecycleManagerV2=true
        command:
        - /bin/olm

2. create operator resource
cat op.yaml 
--
apiVersion: operators.coreos.com/v2alpha1
kind: Operator
metadata:
  name: etcd-test
spec:
  updates:
    type: CatalogSource
    catalogSource:
      package: etcd
      channel: singlenamespace-alpha
      entrypoint: etcdoperator.v0.9.4
      approval: Automatic
      ref:
        name: community-operators
        namespace: openshift-marketplace
--
oc apply -f op.yaml

3. create sub
cat sub-etcd-092.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: etcd
  namespace: default
spec:
  channel: singlenamespace-alpha
  installPlanApproval: Manual
  name: etcd
  source: community-operators
  sourceNamespace: openshift-marketplace
  startingCSV: etcdoperator.v0.9.2
kuiwang@Kuis-MacBook-Pro OCP-29666 % oc apply -f sub-etcd-092.yaml 
subscription.operators.coreos.com/etcd created

4. create og
kuiwang@Kuis-MacBook-Pro OCP-29666 % cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single
  namespace: default
spec:
  targetNamespaces:
  - default

kuiwang@Kuis-MacBook-Pro OCP-29666 % oc apply -f og-single.yaml

5. approve ip
kuiwang@Kuis-MacBook-Pro OCP-29666 % oc get ip
NAME            CSV                   APPROVAL   APPROVED
install-ncrjz   etcdoperator.v0.9.2   Manual     false
kuiwang@Kuis-MacBook-Pro OCP-29666 % oc edit ip install-ncrjz
installplan.operators.coreos.com/install-ncrjz edited
--
approved: true
--

6. apply label for csv
oc label csv etcdoperator.v0.9.2 operators.coreos.com/etcd-test=""

7. check condition via operator resource
oc get operator etcd-test -o yaml 


Actual results:
--
- lastTransitionTime: "2020-04-30T07:05:13Z"
        lastUpdateTime: "2020-04-30T07:05:13Z"
        message: all requirements found, attempting install
        reason: AllRequirementsMet
        status: ""
        type: ""
--

Expected results:
--
- lastTransitionTime: "2020-04-30T07:05:13Z"
    lastUpdateTime: "2020-04-30T07:05:13Z"
    message: all requirements found, attempting install
    phase: InstallReady
    reason: AllRequirementsMet
--

Additional info:

Comment 9 kuiwang 2020-09-14 06:14:39 UTC
its verification is blocked by https://bugzilla.redhat.com/show_bug.cgi?id=1878023
After https://bugzilla.redhat.com/show_bug.cgi?id=1878023 is verified, I will verify it.

Comment 11 kuiwang 2020-09-18 01:48:28 UTC
verify it on 4.6 cluster. the origin issue is verified. LGTM
but there is new issue possible introduced by it, so create https://bugzilla.redhat.com/show_bug.cgi?id=1880220 to track it.

--
kuiwang@Kuis-MacBook-Pro 1829735 % oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.6.0-0.nightly-2020-09-17-050000   True        False         96m     Cluster version is 4.6.0-0.nightly-2020-09-17-050000
kuiwang@Kuis-MacBook-Pro 1829735 % oc exec catalog-operator-7b76596b48-mg47w -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.16.1
git commit: 78bb41b4613cafca7264a3108d1f1fa4b66024c8
kuiwang@Kuis-MacBook-Pro 1829735 % cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single
  namespace: default
spec:
  targetNamespaces:
  - default

kuiwang@Kuis-MacBook-Pro 1829735 % oc apply -f og-single.yaml 
cat catsrc.yamloperatorgroup.operators.coreos.com/og-single created
kuiwang@Kuis-MacBook-Pro 1829735 % cat catsrc.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: test-operators
  namespace: default
spec:
  image: quay.io/kuiwang/olm-api:v1
  displayName: Test Operators
  icon:
    base64data: ""
    mediatype: ""
  publisher: Red Hat
  sourceType: grpc
  updateStrategy:
    registryPoll:
      interval: 10m0s
kuiwang@Kuis-MacBook-Pro 1829735 % oc apply -f catsrc.yaml 
catalogsource.operators.coreos.com/test-operators created
kuiwang@Kuis-MacBook-Pro 1829735 % cat sub.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: etcd
  namespace: default
spec:
  channel: singlenamespace-alpha
  installPlanApproval: Automatic
  name: etcd
  source: test-operators
  sourceNamespace: default
  startingCSV: etcdoperator.v0.9.4
kuiwang@Kuis-MacBook-Pro 1829735 % oc apply -f sub.yaml
subscription.operators.coreos.com/etcd created
kuiwang@Kuis-MacBook-Pro 1829735 % oc get csv
NAME                  DISPLAY   VERSION   REPLACES              PHASE
etcdoperator.v0.9.4   etcd      0.9.4     etcdoperator.v0.9.2   Succeeded

kuiwang@Kuis-MacBook-Pro 1829735 % oc get operator etcd.default -o=json | jq .                
{
  "apiVersion": "operators.coreos.com/v1",
  "kind": "Operator",
  "metadata": {
    "creationTimestamp": "2020-09-18T01:19:34Z",
    "generation": 1,
    ...
    "name": "etcd.default",
    "resourceVersion": "124663",
    "selfLink": "/apis/operators.coreos.com/v1/operators/etcd.default",
    "uid": "2d696d7f-0313-47b3-8e0d-5470abcc6497"
  },
  "spec": {},
  "status": {
    "components": {
      "labelSelector": {
        "matchExpressions": [
          {
            "key": "operators.coreos.com/etcd.default",
            "operator": "Exists"
          }
        ]
      },
      "refs": [
        ...
        {
          "apiVersion": "operators.coreos.com/v1alpha1",
          "conditions": [
            {
              "lastTransitionTime": "2020-09-18T01:19:50Z",
              "lastUpdateTime": "2020-09-18T01:19:50Z",
              "message": "install strategy completed with no errors",
              "reason": "InstallSucceeded",
              "status": "True",
              "type": "Succeeded"
            }
          ],
          "kind": "ClusterServiceVersion",
          "name": "etcdoperator.v0.9.4",
          "namespace": "default"
        }
      ]
    }
  }
}


--

Comment 14 errata-xmlrpc 2020-10-27 15:58:32 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