Bug 1989504 - The code logic of channel clear is ambiguous, as well as the help info and output messages
Summary: The code logic of channel clear is ambiguous, as well as the help info and ou...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.9
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.9.0
Assignee: W. Trevor King
QA Contact: Yang Yang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-03 11:12 UTC by Yang Yang
Modified: 2021-10-18 17:44 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-10-18 17:44:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 891 0 None None None 2021-08-10 00:46:09 UTC
Red Hat Product Errata RHSA-2021:3759 0 None None None 2021-10-18 17:44:18 UTC

Description Yang Yang 2021-08-03 11:12:04 UTC
Description of problem:
In the description of PR[1], it says "Clearing from an unknown channel does not require an override"

$ oc adm upgrade
Cluster version is 4.9.0-0.nightly-2021-07-31-093358
Upstream: https://github.com/shellyyang1989/upgrade-cincy/raw/master/cincy5.json
Channel: channel-f (available channels: channel-a, channel-b)
Updates:
VERSION                           IMAGE
4.9.0-0.nightly-2021-08-01-102437 registry.ci.openshift.org/ocp/release@sha256:421304acff8d9c5bf24365c42460721f9ae1392dd20fbf642c118c163b7731e5

$ oc adm upgrade channel
error: the requested channel "" is not one of the available channels (channel-a, channel-b), you must pass --allow-explicit-channel to continue

channel-f is not a known channel, but oc still requires override.

In addition to it, the help info and the output messages are not clear enough.


[1] https://github.com/openshift/oc/pull/576

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

# oc version
Client Version: 4.9.0-0.nightly-2021-07-28-233309
Server Version: 4.9.0-0.nightly-2021-07-31-093358
Kubernetes Version: v1.21.1+8268f88


How reproducible:
1/1

Steps to Reproduce:
1.
2.
3.

Actual results:
1) $ oc adm upgrade channel
error: the requested channel "" is not one of the available channels (channel-a, channel-b), you must pass --allow-explicit-channel to continue

2) $ oc adm upgrade channel channel-f --allow-explicit-channel
warning: The requested channel "channel-f" is not one of the available channels (channel-a, channel-b).  You have used --allow-explicit-channel to proceed anyway.

3) $ oc adm upgrade channel channel-d --allow-explicit-channel
warning: No channels known to be compatible with the current version "4.9.0-0.nightly-2021-07-31-093358"; unable to validate "channel-d".

4) Upstream is unset, so the cluster will use an appropriate default.

Expected results:
1) $oc adm upgrade channel
error: You are requesting to clear the update channel. The current channel "channel-a" is one of available channels (channel-a, channel-b), you must pass --allow-explicit-channel to continue

2) $ oc adm upgrade channel channel-f --allow-explicit-channel
warning: The requested channel "channel-f" is not one of the available channels (channel-a, channel-b).  You have used --allow-explicit-channel to proceed anyway. Setting the update channel to "channel-f".

3) $ oc adm upgrade channel channel-d --allow-explicit-channel
warning: No channels known to be compatible with the current version "4.9.0-0.nightly-2021-07-31-093358"; unable to validate "channel-d". Setting the update channel to "channel-d" anyway.

4) Upstream is unset, so the cluster will use the default.

Additional info:

Comment 1 Yang Yang 2021-08-03 11:47:02 UTC
Trevor, I'm attempting to fix it by [1]. Please take a look. If I misunderstand it, it's fine to reject it. Thanks!

[1] https://github.com/openshift/oc/pull/891

Comment 5 Yang Yang 2021-09-02 02:01:12 UTC
Verifying with 
# oc version
Client Version: 4.9.0-0.nightly-2021-09-01-193941
Server Version: 4.9.0-0.nightly-2021-08-28-082738
Kubernetes Version: v1.22.0-rc.0+b708912

# oc adm upgrade channel --help
Set or clear the update channel.

 This command will set or clear the update channel, which impacts the list of
updates recommended for the cluster.

 If desired channel is empty, the command will clear the update channel. If
there is a list of acceptable channels and the current update channel is in that
list, you must pass --allow-explicit-channel to allow channel clear to proceed.

 If desired channel is not empty, the command will set the update channel to it.
If there is a list of acceptable channels and the desired channel is not in that
list, you must pass --allow-explicit-channel to allow channel change to proceed.

# oc adm upgrade 
Cluster version is 4.9.0-0.nightly-2021-08-28-082738

Upstream: https://raw.githubusercontent.com/shellyyang1989/upgrade-cincy/master/cincy3.json
Channel: channel-b (available channels: channel-a, channel-b)
Updates:

VERSION                           IMAGE
4.9.0-0.nightly-2021-08-28-134805 registry.ci.openshift.org/ocp/release@sha256:a10a4358850af7b5c288e81be38b92673cabd79f1f59d8e632dc122e5ab0561b

Set a channel which is same as the current channel
# oc adm upgrade channel channel-b
info: Cluster is already in channel-b (no change)

Clear a known channel  which is in the available channels w/o --allow-explicit-channel
# oc adm upgrade channel
error: You are requesting to clear the update channel. The current channel "channel-b" is one of the available channels, you must pass --allow-explicit-channel to continue

Clear a known channel  which is in the available channels w/ --allow-explicit-channel
# oc adm upgrade channel --allow-explicit-channel
warning: Clearing channel "channel-b"; cluster will no longer request available update recommendations.

Re-clear the channel
# oc adm upgrade channel
info: Cluster channel is already clear (no change)

Set to an unknown channel when the available channels are not present w/o --allow-explicit-channel
# oc adm upgrade channel channel-d
warning: No channels known to be compatible with the current version "4.9.0-0.nightly-2021-08-28-082738"; unable to validate "channel-d". Setting the update channel to "channel-d" anyway.

Set to an unknown  channel which is not in the available channels w/o --allow-explicit-channel
# oc adm upgrade channel channel-f
error: the requested channel "channel-f" is not one of the available channels (channel-a, channel-b), you must pass --allow-explicit-channel to continue

Set to an unknown channel which is not in the available channels w/ --allow-explicit-channel
# oc adm upgrade channel channel-f --allow-explicit-channel
warning: The requested channel "channel-f" is not one of the available channels (channel-a, channel-b). You have used --allow-explicit-channel to proceed anyway. Setting the update channel to "channel-f".

Clear an unknown channel  which is not in the available channels w/o --allow-explicit-channel
# oc adm upgrade channel
warning: Clearing channel "channel-f"; cluster will no longer request available update recommendations.

Set to a known channel when the available channels are not present
# oc adm upgrade channel channel-a
warning: No channels known to be compatible with the current version "4.9.0-0.nightly-2021-08-28-082738"; unable to validate "channel-a". Setting the update channel to "channel-a" anyway.

Set to a known channel w/o --allow-explicit-channel
# oc adm upgrade channel channel-b

Moving it to verified.

Comment 8 errata-xmlrpc 2021-10-18 17:44:09 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 (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), 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/RHSA-2021:3759


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