kubectl-operator icon indicating copy to clipboard operation
kubectl-operator copied to clipboard

Use kubectl common syntax to query resources

Open akram opened this issue 5 years ago • 2 comments

Hi all,

I am new to kubectl operator , so just an RFE to start with: It would be more intuitive to use the common query syntax for the kubectl operator commands:

e.g: replace:

kubectl operator catalog list -A

with:

kubectl operator get catalogs --all-namespaces
kubectl operator get catalog --all-namespaces
kubectl operator get catalog -A

Same thing for add and remove , that can respectively changed to create and delete

akram avatar Sep 09 '20 13:09 akram

This syntax would generally work for the catalog subcommands, but it seems like it breaks down for verbs directly on operators.

Using the example from here, typing operator twice seems like unnecessary repetition to me.

With this plugin, it is difficult to totally align to existing kubectl idioms without introducing this repetition. kubectl subcommands are typically <verb> <noun>, but because this plugin contains so many different verbs, it made more sense to us to flip that and make this plugin use the <noun> <verb> style.

joelanford avatar Sep 09 '20 15:09 joelanford

Hi @joelanford , yes, this repetition may look a bit heavy in the case you mentionned; but, that's a drawback to have consistency. And this repetition may only occur for operator . In terms of user experience I am willing to accept this especially, if I have some short names that I can use to avoid this repetition:

kubectl operator get ops
kubectl operator get subs
kubectl operator get cats # not the one you think about 

That would be more convenient for all kubectl/oc users and it will avoid to do a mental gym every time to remember that the order is reversed. Also, intensive users may for sure, use an alias kop=$(kubectl operator) (if it works, it seems not :-) ) and will do things like:

kop get ops
kop get subs

akram avatar Sep 10 '20 07:09 akram