kubectl icon indicating copy to clipboard operation
kubectl copied to clipboard

Proposal: Deprecate the usage of NoOptDefVal on flags

Open rikatz opened this issue 1 year ago • 10 comments

What would you like to be added: Not added, but removed 😓

We use NoOptDefVal on flags like dry-run, validate and others (mapped below). This generates confusion on the command, as we accept string flags as key=value or key value, but when using NoOptDefVal this is not possible.

This separation of a value makes sense, for instance, let's take validate flag as an example:

kubectl create deploy --image=nginx --validate strict

In this case, do I want to create a deploy called strict and default value, or do I want to do strict validation but I forgot the deployment name? It is not possible to get it.

We already stated that this behavior will be deprecated on the dry-run flag, but I think we should move forward and do with all the other string flags.

If you pass a string flag, you should know what value you want (and not be susceptible to future behavior change if we want to change the "default hidden value".

This will also help to generate consistency in command usage, knowing that string flags can or can't be separated by "=" and that anything else is the real command arg.

Why is this needed: Generate some consistency on command execution

I will try to remember the next sig-cli meeting to bring this subject, but also anyone looking at this feel free to comment here and tell me if it is worth to discussing this or if this behavior is this way and will not change, and close the issue :)

Commands and flags currently with this behavior

  • validate and dry-run flags on create * command
  • cascade flag on delete * command
  • set-raw-bytes flag on config set command
  • insecure-skip-tls-verify and embed-certs flag on config set-cluster command
  • embed-certs flag on config set-credentials command

rikatz avatar Jun 15 '23 01:06 rikatz