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

View and select context similar to kubectl config get-contexts / use-context #38

Open
t0meck opened this issue Apr 11, 2019 · 9 comments

Comments

@t0meck
Copy link

t0meck commented Apr 11, 2019

Hello

Great tool. The only thing I miss is to be able to switch contexts in a way similar to how namespaces are selected. In README.md it is mentioned that there is interactive switching of contexts but I haven't found out how to do this.

It's just that I'm tired of constantly entering "kubectl config use-context" when I have to switch between clusters. I planned to write myself a script written in "dialog" to present a list of contexts and select one of them but then I found out your tool. It's great but I still miss this function in it.

If possible please add it.

Kind regards
Tom

@astefanutti
Copy link
Owner

Hi thanks for the feedback.

We've have somehow divided the context management in two separate dialog:

  • Pressing the l key to browse and change contexts
  • Pressing the n key to switch between namespace

Let us know if the dialog open with the l key meets your need. Otherwise, it may be useful to have a dialog closer the what kubectl config get-contexts outputs.

@t0meck
Copy link
Author

t0meck commented Apr 11, 2019

Nope. When I press "l" (lowercase L) i get a dialog which shows login instead of list of contexts.
I use AKS (Azure Kubernetes Services) and config is put there by "az aks get-credentials -n AKS_NAME -g AKS_RESOURCE_GROUP" so I don't operate usually on tokens etc...

I mean:
kubectl config get-contexts -o name
Can output of above command be put in a box like switching between namespaces is organized?
Or if not possible to call different command then above command just read ~/.kube/config which is written in yaml format and just extract:

  • contexts.context.name and if possible also contexts.context.namespace
  • current-context

@astefanutti
Copy link
Owner

Actually, from the login dialog (open by pressing the l key), you can browse and switch context using the left and right arrow keys. I plan to make that more obvious from the UI, and provide more fields for the contexts in addition to username / password / token.

I'm not familiar with AKS, but if it uses the az aks get-credentials command as exec field from the user Kube config to retrieve the token, this is something that has yet to be supported by Kubebox as in #32.

@t0meck
Copy link
Author

t0meck commented Apr 12, 2019

No. az aks get-credentials will connect to azure and download from it credentials which are needed to connect to cluster. It will also append them to kube/config automatically.
So what is only required is just to read the kube/config file and use credentials stored there.

@astefanutti
Copy link
Owner

Then, you should be able to find the corresponding context in the login widget with the left and right arrow keys.

@t0meck
Copy link
Author

t0meck commented Apr 12, 2019

Ok. They're there. Thx.
But even then if possible, selecting connection from list like namespaces are shown is much more convenient.

@astefanutti
Copy link
Owner

Yes, I agree it's not very convenient, especially as the number of contexts increases. We need to improve the UI for browsing / switching contexts. Thanks for the feedback.

@t0meck
Copy link
Author

t0meck commented Apr 12, 2019

If contents for this window is provided from kube/config then rewriting it to show list with names and urls to cluster along with +/- buttons which would then literally add or remove configs to/from kube/config would be enough I suppose.

I wish my skill in node was higher so I could help here...

@astefanutti
Copy link
Owner

Yes, the content of the login widget is sourced from the kubeconfig file. It's just a matter of improving the UI.

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

No branches or pull requests

2 participants