-
Notifications
You must be signed in to change notification settings - Fork 26
Support lookup by name or ID for all VM, cluster, and network commands #543
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
Support lookup by name or ID for all VM, cluster, and network commands #543
Conversation
… commands Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally lgtm, I think we should stop supporting --name
since we now offer support for id or name in arg0
and it's more feature-rich as it supports completions. Perhaps we should initially hide --name
and guide people to using the arg0
functionality and deprecate it? Your call Devin.
…ted in arguments Co-Authored-By: [email protected] <[email protected]>
@AmberAlston do you mind taking a look at this since this means deprecating the |
I've implemented the suggested changes to deprecate the |
Given this change, explain exactly what the customer experience will be if they still pass the |
When a customer uses a deprecated flag like
The command will then proceed to execute normally, removing clusters with the specified name. This provides a smooth transition path for users while guiding them toward the new, more consistent usage pattern. |
When I pass
|
I've fixed the issue with handling multiple VMs/clusters/networks with the same name in the rm commands. Now when you run |
We should update the help text where appropriate to ensure we specify that when removing by name and multiple IDs with given name exist they will all be removed if matched. |
… with the same name Co-Authored-By: [email protected] <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we're still missing functionality for id/name completion for the following commands:
replicated cluster kubeconfig
replicated cluster update
replicated cluster shell
replicated cluster upgrade
replicated cluster addon create object-store
replicated vm update
…function - Added ID/name lookup to cluster_kubeconfig, cluster_shell, cluster_update, cluster_upgrade, and cluster_addon_create_objectstore commands - Fixed VM completion function to include resources outside of 'running' state - Updated help text to clarify behavior with multiple resources with the same name - Ensured consistent implementation across all commands Co-Authored-By: [email protected] <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, just a few issues with using deprecated flags in --help
.
|
||
# Download kubeconfig for a cluster by name | ||
# Download kubeconfig for a cluster by name using a flag | ||
replicated cluster kubeconfig --name "My Cluster" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deprecated with the same warning we used for other deprecations in this PR.
replicated cluster kubeconfig --name "My Cluster" | ||
|
||
# Download kubeconfig for a cluster by ID | ||
# Download kubeconfig for a cluster by ID using a flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deprecated with the same warning we used for other deprecations in this PR.
# Open a shell for a cluster by name | ||
replicated cluster shell --name "My Cluster"`, | ||
# Open a shell for a cluster by name using a flag | ||
replicated cluster shell --name "My Cluster" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deprecated with the same warning we used for other deprecations in this PR.
replicated cluster shell --name "My Cluster" | ||
|
||
# Open a shell for a cluster by ID using a flag | ||
replicated cluster shell --id CLUSTER_ID`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deprecated with the same warning we used for other deprecations in this PR.
cli/cmd/vm_ssh_endpoint.go
Outdated
@@ -100,8 +100,8 @@ func (r *runners) getVMIDFromArg(arg string) (string, error) { | |||
case 1: | |||
return matchingVMs[0], nil | |||
default: | |||
return "", errors.Errorf("Multiple VMs found with name '%s'. Please use the VM ID instead. Matching VMs: %s. To view all VM IDs run `replicated vm ls`", | |||
arg, | |||
return "", errors.Errorf("Multiple VMs found with name '%s'. Please use the VM ID instead. Matching VMs: %s. To view all VM IDs run `replicated vm ls`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "", errors.Errorf("Multiple VMs found with name '%s'. Please use the VM ID instead. Matching VMs: %s. To view all VM IDs run `replicated vm ls`", | |
return "", errors.Errorf("Multiple VMs found with name %q. Please use the VM ID instead. Matching VMs: %s. To view all VM IDs run `replicated vm ls`", |
…ate error message format Co-Authored-By: [email protected] <[email protected]>
Oh sorry, one last thing, the help text for some of the commands is still referencing |
…mmands Co-Authored-By: [email protected] <[email protected]>
Support lookup by name or ID for all VM, cluster, and network commands
This PR extends the pattern implemented in the
vm ssh-endpoint
command to all other VM, cluster, and network commands. Now all these commands can accept either an ID or a name parameter.Changes
Testing
make build
make test-unit
Link to Devin run: https://app.devin.ai/sessions/2f0b35eefee241a0bc6c7403f3cc45ef
Requested by: [email protected]