Bug 1829735 - the condition of csv component listed via operator resource is not correct
Summary: the condition of csv component listed via operator resource is not correct
Keywords:
Status: VERIFIED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.6.0
Assignee: Nick Hale
QA Contact: kuiwang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-30 08:33 UTC by kuiwang
Modified: 2020-09-18 01:48 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github operator-framework operator-lifecycle-manager pull 1732 None closed Bug 1829735: fix(operator): map top-level csv phase to component conditions 2020-09-18 12:26:57 UTC

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"
        }
      ]
    }
  }
}


--


Note You need to log in before you can comment on or make changes to this bug.