-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ocm describe cluster
fails for Archived/Deprovisioned clusters
#517
Comments
First step towards openshift-online#517. At least doesn't lie to user and gives hint how to find past data: Error: Can't retrieve cluster for key '0e68a621-c00e-4bbf-a4bb-9915ae6cc947': Cluster was Deprovisioned, see `ocm get subscription 2S434jffVG4fSgDdK4cbkDTxVNp` for details This affects ALL commands that use `GetCluster` helper. Behavior change: when there is 1 active cluster and also 1+ past clusters reusing same display_name, previously the active one was used; now will refuse treating them as ambiguous: > ocm get subs -p search="display_name in ('servheredia')" | jq .items[].status | sort | uniq -c 4 "Deprovisioned" 1 "Reserved" > ocm describe cluster servheredia Error: Can't retrieve cluster for key 'servheredia': There are 5 subscriptions with cluster identifier or name 'servheredia'
So my #518 caused some complaints, at least from 2 internal users, when reusing a display_name of previously deleted clusters 👎 Scenarios:
=> So I'm gonna revert it (maybe tweaking the "not found" wording a little). Luckily, both old and new GetCluster() logic only allow "Reserved" and "Active" cluster: ocm-cli/pkg/cluster/cluster.go Lines 199 to 200 in 6d866ac
There is no functionality yet to actually operate on archived/deprovisioned clusters, so it won't break any command. Only the message for "matches exactly 1 deleted cluster" will become less informative, but the "1 active + 1 or more deleted" use case is more important. |
Huh, #518 may have also broken handling of clusters in some other states. When zero subscriptions matched, it falls back to querying clusters, and if it finds exactly 1 it returns it successfully. For example IIUC in old logic, a Stale subscription would not match so it'd fall back and the cluster could be returned(?), while with #518 it will find the subscription and error out, not give the fallback a chance 👎
|
|
Yep, current code refuses to describe a Stale cluster (with unambiguous ID!):
and works with #518 reverted:
|
|
here is an example Deprovisioned subscription
and now let's try to
ocm describe cluster
it:These messages are both misleading technically (there is a subscription with these ids) and unfortunate☹️ .
Here are the accessed APIs:
clusters
API indeed stops returning data on Archived/Deprovisioned clusters, butsubscriptions
API retains a lot of info that could be shown (as UI does on https://console.redhat.com/openshift/archived).Peeking at GetCluster() helper code, it does query subscriptions but appends
status in ('Reserved', 'Active')
clause.=> improve GetCluster message when Subscription exists but is inactive #518
GetCluster
helper returns acmv1.Cluster
so would be unsuitable anyway when we only have subscription data.=> Add a new GetSubscription / GetSubscriptionAndCluster helper?
PrintClusterDescription
would need many adjustments to deal with partial data...--output
and--json
flags now dump Cluster JSON. How can we extend them to include Subscription too / support cases of having only Subscription?The text was updated successfully, but these errors were encountered: