vmware-tanzu / tanzu-framework

Tanzu Framework provides a set of building blocks to build atop of the Tanzu platform and leverages Carvel packaging and plugins to provide users with a much stronger, more integrated experience than the loose coupling and stand-alone commands of the previous generation of tools.
Apache License 2.0
196 stars 193 forks source link

Issues around Tanzu cli login command #1859

Open thesteve0 opened 2 years ago

thesteve0 commented 2 years ago

Bug Report

The documentation tanzu login --help has issues in explaining how to use the command. The error message when the flags are not complete is unhelpful.

Expected Behavior

Help Documentation

If I have a .kube/config file that is properly configured and I want to use it to login to my management cluster I think this correspeonds to these example in the cli doc

 # Login to TKG management cluster by using kubeconfig path and context for the management cluster
        tanzu login --kubeconfig path/to/kubeconfig --context path/to/context --name mgmt-cluster

        # Login to TKG management cluster by using default kubeconfig path and context for the management cluster
        tanzu login  --context path/to/context --name mgmt-cluster

There is no "path" to a context to use in the config file. It is just a name that specifies which context corresponds to our management cluster. The current instructions confuses the user and makes them think that perhaps there is something else you are asking for

I think the help for --content should be

--context context-name

or

--context contextName

When the tanzu cli adds a context to a kube config file it typically names them

clustername-admin@clustername

If we want to make the assumption we created the context that people want to use, I would also be OK with making that the example name. I do not think that assumption holds but I just wanted to put it out there.

Error message

When I used this command I kept forgetting to put the --name at the end of the command and so the command failed. Unfortunately this is the error message that came back is this

> tanzu login --kubeconfig ~/.kube/config  --context management-admin@management
 failed to login to the management cluster management, unable to read kubeconfig

That config is the correct location for the config file and that is the right name of the context. The real problem is I didn't pass in a required parameter "--name". The error message should have said something like:

failed to provide required parameter --name
github-actions[bot] commented 2 years ago

Hey @thesteve0! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Tanzu Framework.

thesteve0 commented 2 years ago

It also turns out that the --name has to match the name of the cluster. I am not sure what "name" we need to match but my guess is the actual cluster name from the context. But I am confused why we need that when the information is already in the kube config file

codegold79 commented 2 years ago

I agree the help messages should be more helpful, so thank you, @thesteve0, for submitting this issue.

It also turns out that the --name has to match the name of the cluster. Is the error the same as what was reported in #1859?