Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1719958

Summary: oc get clusterversion does not list version when there is an error state on update
Product: OpenShift Container Platform Reporter: Clayton Coleman <ccoleman>
Component: Cluster Version OperatorAssignee: Clayton Coleman <ccoleman>
Status: CLOSED ERRATA QA Contact: liujia <jiajliu>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.zCC: adahiya, aos-bugs, decarr, jokerman, mmccomas, wsun
Target Milestone: ---   
Target Release: 4.1.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: 4.1.6
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-23 18:12:07 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 Clayton Coleman 2019-06-12 19:52:22 UTC
If the CVO is updating to a new version but hits an error, `oc get clusterversion` prints no value in the status column because the CRD is viewing the wrong object.

Instead, use the first entry in the history list which is always the "desired" or "completed" version.

https://github.com/openshift/cluster-version-operator/pull/189 merged to master right after 4.2 branch but before 4.1.  This fix should be in 4.1.z to ensure users aren't confused during upgrades.

Comment 2 liujia 2019-07-04 06:23:08 UTC
Reproduce on 4.1.0-0.nightly-2019-05-05-070156

Steps:
1. Install cluster with 4.1.0-0.nightly-2019-05-05-070156 nightly build.
2. Run "oc adm upgrade --to-image=registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-06-27-201210" to do upgrade, but failed due to image signature
3. Check the version column is empty in "oc get clusterversion" output, and so is the desiredUpdate in clusterversion.
# oc get clusterversion
NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
version             True        True          7s      Unable to apply registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-06-27-201210: the image may not be safe to use

# oc get clusterversion -o json|jq ".items[0].spec"
{
  "channel": "stable-4.1",
  "clusterID": "9d2ccb4c-64a6-468a-8009-f4d318753a8e",
  "desiredUpdate": {
    "image": "registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-06-27-201210",
    "version": ""
  },
  "upstream": "https://api.openshift.com/api/upgrades_info/v1/graph"
}

Comment 3 liujia 2019-07-04 07:06:23 UTC
Verified on 4.1.0-0.nightly-2019-07-03-205519

# oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.1.0-0.nightly-2019-07-03-205519   True        True          5s      Unable to apply registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-07-03-035331: the image may not be safe to use

# oc get clusterversion -o json|jq '.items[0].status.history'
[
  {
    "completionTime": null,
    "image": "registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-07-03-035331",
    "startedTime": "2019-07-04T06:58:26Z",
    "state": "Partial",
    "verified": false,
    "version": ""
  },
  {
    "completionTime": "2019-07-04T06:58:26Z",
    "image": "registry.svc.ci.openshift.org/ocp/release@sha256:58dfc409525884a606e5cc814e10c849544ed885e3e5fbb118f4deab3059465f",
    "startedTime": "2019-07-04T06:40:38Z",
    "state": "Completed",
    "verified": false,
    "version": "4.1.0-0.nightly-2019-07-03-205519"
  }
]

Comment 5 errata-xmlrpc 2019-07-23 18:12:07 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:1766