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

Option to delete user and cluster used by context when deleteing it #202

Open
cardil opened this issue Apr 9, 2020 · 5 comments · May be fixed by #409
Open

Option to delete user and cluster used by context when deleteing it #202

cardil opened this issue Apr 9, 2020 · 5 comments · May be fixed by #409

Comments

@cardil
Copy link

cardil commented Apr 9, 2020

For my use case, using -d is super annoying, as ~/.kube/config file are left with defunkt entries from previously created clusters.

I'd like to request an option to delete user and cluster used by context when deleting it.

@ahmetb
Copy link
Owner

ahmetb commented Apr 9, 2020

Sadly kubectl doesn’t provide clean cmds to delete user and cluster entries. I have an issue open about this for a long while.

Since we don’t directly manipulate the kubeconfig file, it doesn’t seem currently doable. But we can get to it.

@acim
Copy link

acim commented Sep 16, 2020

@zcahana
Copy link

zcahana commented Nov 23, 2023

Is there still interest in this from the project authors? (@ahmetb)
If so, I'm happy to work on adding it.

Also: how would you like to see this being supported?

  1. A separate flag (e.g., -D or -dd)?
  2. A companion flag to -d (e.g., -d -p, "p" is for purge)?
  3. Change behavior of -d

And also: need to consider that the deleted context's cluster/user might still be referenced in other contexts that are still there. In such case, it would be safer to avoid deleting the cluster/user, but possibly provide a way to force the deletion (e.g., -ddd in line with option (1) above, or -d -p -f in line with option (2)).

I personally am more fond of -D and no force deletion of non-orphaned clusters/users, but I'm also good with -dd and -ddd.

@zcahana zcahana linked a pull request Nov 24, 2023 that will close this issue
@ahmetb
Copy link
Owner

ahmetb commented Jan 6, 2024

Yeah, I think we can add -D which actually deletes associated orphaned entries. Changing the default behavior of -d is gonna make some folks upset for sure (given there are a lot of course material and content out there explaining people to set up clusters manually, and manually editing the kubeconfig file to make it work).

I recommend adding this feature only to the Go implementation for the sake of simplicity.

@zcahana
Copy link

zcahana commented Jan 7, 2024

@ahmetb please see #409 which adds this as a new -D flag (indeed, only for the Go implementation 😉).

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