Delete context with cluster and user #409
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an option to delete contexts including their referenced cluster and user entries from the
clusters
/users
lists.The cluster and user entries are only deleted if they are no longer referenced in any other context (i.e., "orphaned").
The new option is exposed via a new CLI flag,
-D
, alongside the original flag (-d
) which retains its existing functionality of deleting the context only.Closes #202.
Implementation notes
deleteContext
function.internal/kubeconfig
package, with new function for inspecting/manipulatingusers
,clusters
and their corresponding references within acontext
.Testing notes
internal/kubeconfig
package.