Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/cli/admin/upgrade/channel: Add 'oc adm upgrade channel ...'
A new subcommand for conveniently managing channels. Example workflow, starting in a channel: $ oc adm upgrade Cluster version is 4.6.0-fc.3 Upstream: https://api.openshift.com/api/upgrades_info/v1/graph Channel: candidate-4.6 (choices: candidate-4.6) Updates: VERSION IMAGE 4.6.0-fc.4 quay.io/openshift-release-dev/ocp-release@sha256:960ec73733150827076cbb5fa2c1f5aaa9a94bfbce1b4897e46432a56ac976c1 4.6.0-fc.5 quay.io/openshift-release-dev/ocp-release@sha256:5883d0db15939484bd477147e6949c53fbc6f551ec20a0f1106b8a3acfb86ef8 Trying to change to the same channel is a no-op: $ oc adm upgrade channel candidate-4.6 info: Cluster is already in candidate-4.6 Trying to change to an unrecognized channel gets a warning: $ oc adm upgrade channel does-not-exist error: the requested channel "does-not-exist" is not one of the available channels (candidate-4.6), you must pass --allow-explicit-channel to continue $ oc adm upgrade channel --allow-explicit-channel does-not-exist warning: The requested channel "does-not-exist" is not one of the available channels (candidate-4.6). You have used --allow-explicit-channel to proceed anyway. $ oc adm upgrade Cluster version is 4.6.0-fc.3 Channel: does-not-exist warning: Cannot display available updates: Reason: VersionNotFound Message: Unable to retrieve available updates: currently reconciling cluster version 4.6.0-fc.3 not found in the "does-not-exist" channel When we have no known channels, changing requires no override: $ oc adm upgrade channel does-not-exist-either warning: No channels known to be compatible with the current version "4.6.0-fc.3"; unable to validate "does-not-exist-either". $ oc adm upgrade channel candidate-4.6 warning: No channels known to be compatible with the current version "4.6.0-fc.3"; unable to validate "candidate-4.6". Clearing a known channel needs an explicit override: $ oc adm upgrade channel error: the requested channel "" is not one of the available channels (candidate-4.6), you must pass --allow-explicit-channel to continue $ oc adm upgrade channel --allow-explicit-channel warning: Clearing channel "candidate-4.6"; cluster will no longer request available update recommendations. $ oc adm upgrade Cluster version is 4.6.0-fc.3 warning: Cannot display available updates: Reason: NoChannel Message: The update channel has not been configured. Trying to re-clear the channel is a no-op: $ oc adm upgrade channel info: Cluster channel is already clear And you can set any channel from a cleared channel without an override, because this is another case where we have no idea what the valid choices are: $ oc adm upgrade channel candidate-4.6 warning: No channels known to be compatible with the current version "4.6.0-fc.3"; unable to validate "candidate-4.6". $ oc adm upgrade Cluster version is 4.6.0-fc.3 Upstream: https://api.openshift.com/api/upgrades_info/v1/graph Channel: candidate-4.6 (choices: candidate-4.6) Updates: VERSION IMAGE 4.6.0-fc.4 quay.io/openshift-release-dev/ocp-release@sha256:960ec73733150827076cbb5fa2c1f5aaa9a94bfbce1b4897e46432a56ac976c1 4.6.0-fc.5 quay.io/openshift-release-dev/ocp-release@sha256:5883d0db15939484bd477147e6949c53fbc6f551ec20a0f1106b8a3acfb86ef8 Clearing from an unknown channel does not require an override either: $ oc adm upgrade channel --allow-explicit-channel does-not-exist warning: The requested channel "does-not-exist" is not one of the available channels (candidate-4.6). You have used --allow-explicit-channel to proceed anyway. $ oc adm upgrade channel warning: Clearing channel "does-not-exist"; cluster will no longer request available update recommendations. Completions updated with: $ hack/update-generated-completions.sh
- Loading branch information