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

current-context in ~/.kube/config not cleaned up #527

Closed
Jeffwan opened this issue Feb 8, 2019 · 6 comments · Fixed by #541
Closed

current-context in ~/.kube/config not cleaned up #527

Jeffwan opened this issue Feb 8, 2019 · 6 comments · Fixed by #541
Labels
area/general-cli good first issue Good for newcomers help wanted Extra attention is needed kind/bug

Comments

@Jeffwan
Copy link
Contributor

Jeffwan commented Feb 8, 2019

What happened?
After I delete the cluster, current-context still have the old context username@cluster-name.us-west-2.eksctl.io which has not been cleaned up.

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://localhost:6443
  name: docker-desktop
contexts:
- context:
    cluster: docker-desktop
    user: docker-desktop
  name: docker-desktop
current-context: username@cluster-name.us-west-2.eksctl.io
kind: Config
preferences: {}
users:
- name: docker-desktop
  user:

if there's only one cluster, result as follow

apiVersion: v1
clusters: []
contexts: []
current-context: username@cluster-name.us-west-2.eksctl.io
kind: Config
preferences: {}
users: []

What you expected to happen?
I expect the cluster context resume to the valid one.

How to reproduce it?
create cluster and delete cluster.

Anything else we need to know?

Versions
Please paste in the output of these commands:

$ eksctl version
[ℹ]  version.Info{BuiltAt:"", GitCommit:"", GitTag:"0.1.19"}
$ uname -a
MacOS
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.0", 

Also include your version of heptio-authenticator-aws

Logs
Include the output of the command line when running eksctl. If possible, eksctl should be run with debug logs. For example:
eksctl get clusters -v 4
Make sure you redact any sensitive information before posting.
If the output is long, please consider a Gist.

@Jeffwan Jeffwan changed the title current-context in ~/.kube/config not cleanedup current-context in ~/.kube/config not cleaned up Feb 8, 2019
@errordeveloper errordeveloper added help wanted Extra attention is needed good first issue Good for newcomers kind/bug area/general-cli labels Feb 11, 2019
@errordeveloper
Copy link
Contributor

errordeveloper commented Feb 11, 2019

@Jeffwan thanks for reporting this! I can confirm I've noticed it a few times also. Would you be keen on fixing this?

@Jeffwan
Copy link
Contributor Author

Jeffwan commented Feb 11, 2019

I've never contributed to eksctl, Let me take a look.

@errordeveloper
Copy link
Contributor

errordeveloper commented Feb 11, 2019 via email

@Jeffwan
Copy link
Contributor Author

Jeffwan commented Feb 11, 2019

/cc @Jeffwan

@Jeffwan
Copy link
Contributor Author

Jeffwan commented Feb 12, 2019

@errordeveloper If we have two cluster and delete current using one. Should eksctl set current-context to empty (no current-context) or any context available?

I am thinking auto switch to other context might be user friendly but it bring risk user create/delete resource in other cluster due to mistakes. Using empty context force user choose context after current cluster deletion but it's safe.

What do you think?

@errordeveloper
Copy link
Contributor

errordeveloper commented Feb 13, 2019

We could clear the context whenever it does look like ours (i.e matches <username>@<cluster-name>.<region>.eksctl.io format), and we no longer see the definition of the context itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/general-cli good first issue Good for newcomers help wanted Extra attention is needed kind/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants