Drop ValidArgsFunction from 'kelos create workspace'

Merged
KE
5mo ago
+21-3

What type of PR is this?

/kind bug

What this PR does / why we need it:

The create workspace subcommand wired completeWorkspaceNames as its
ValidArgsFunction, which means tab-completing kelos create workspace <TAB>
suggested the names of workspaces that already exist in the cluster. But
kelos create calls cl.Create, which fails with AlreadyExists on
collision, so every tab-completed suggestion was guaranteed to fail.

This change removes the misleading wiring so create workspace mirrors
create agentconfig, where the positional name argument is free-form
and no completions are suggested.

A new TestValidArgsFunctionNotWired regression test asserts that
neither create workspace nor create agentconfig has a
ValidArgsFunction set.

Which issue(s) this PR is related to:

Fixes #1172

Special notes for your reviewer:

completeWorkspaceNames itself is unchanged and is still used by
get workspace and delete workspace, which legitimately operate on
existing resources.

Does this PR introduce a user-facing change?

Fixed `kelos create workspace` to no longer suggest names of existing workspaces during shell completion, which would always fail with AlreadyExists.

Summary by cubic

Stop shell completion from suggesting existing workspace names for kelos create workspace, which always failed with AlreadyExists. Creation name is now free-form, matching create agentconfig. Fixes #1172.

  • Bug Fixes
    • Removed ValidArgsFunction from create workspace; completeWorkspaceNames remains for get and delete.
    • Added regression test to ensure no ValidArgsFunction on create workspace and create agentconfig.