Skip to content
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

cloudctl login prints misleading error message if KUBECONFIG env-variable contains more than one filepath #79

Open
droid42 opened this issue Jun 8, 2021 · 5 comments · May be fixed by #120

Comments

@droid42
Copy link
Contributor

droid42 commented Jun 8, 2021

Currently cloudctl login does not print a helpful error message if the KUBECONFIG env-variable contains more than one filepath.

Steps to reproduce:

export KUBECONFIG=somepath1/config.yml:somepath2/config.yml
cloudctl login
Opening Browser for Authentication. If this does not work, please point your browser to http://localhost:45583
{"level":"error","time":"2021-06-08T10:36:49.437+0200","caller":"auth/auth.go:472","message":"error handling token","error":"open : no such file or directory"}

The 'whoami'-command already prints a helpful error message. I would suggest to print this error message on the login command, too.

cloudctl whoami
Error: there are multiple files in env KUBECONFIG, don't know which one to update - please use cmdline-option
@tjuerge
Copy link

tjuerge commented Oct 6, 2021

We struggled with this non-helpful error message as well. Without this GH issue (which connects the error message with KUBECONFIG) we would not have found the cause.

Btw. for troubleshooting (e.g. via DEBUG=1 cloudctl login) some kind of debug logging would be helpful.

@majst01
Copy link
Collaborator

majst01 commented Oct 6, 2021

As we do not have a simple solution for this specific use-case, we strongly recommend using different KUBECONFIG env settings depending on your needs. You could also have a look at the new --merge option to the cloudctl cluster kubeconfig <clusterid> command.

@tjuerge
Copy link

tjuerge commented Oct 6, 2021

Ok, a brute-force approach to detect this use-case would be implementing in login.go the same as within whoami.go - trying to load kubeconf first :-)

authContext, err := api.GetAuthContext(viper.GetString("kubeconfig"))
			if err != nil {
				return err
			}

@mwennrich
Copy link
Contributor

mwennrich commented Oct 6, 2021

As I guess most users already set something like export CLOUDCTL_KUBECONFIG=/home/user/.cloudctl_kubeconfig anyway, we could think about storing the credentials not in the default $KUBECONFIG in the first place, but create an own file for this?

@majst01 majst01 linked a pull request Oct 6, 2021 that will close this issue
@tjuerge
Copy link

tjuerge commented Oct 6, 2021

As I guess most users already set something like export CLOUDCTL_KUBECONFIG=/home/user/.cloudctl_kubeconfig anyway

Just curious, is the envvar CLOUDCTL_KUBECONFIG (similar to CLOUDCTL_URL and CLOUDCTL_APITOKEN) officially supported by cloudctl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants