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

[Suggestion] Remove the kube context: user, cert & key from kubeconfig when we delete a cluster #458

Open
cmoulliard opened this issue Nov 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@cmoulliard
Copy link
Contributor

cmoulliard commented Nov 22, 2024

Suggestion

Remove from the kubeconfig file the kube context (user, cert & key, etc) when we delete a cluster.

When we delete an idpbuilder cluster, the kind cluster is well removed but not the kube context from the kubeconfig file. This is due to the fact that we are missing to pass the path of the file to the command kind lib function provider.Delete(name, "")

// see https://github.com/cnoe-io/idpbuilder/blob/8c6cd9704ae118981a89b3c5b541db1924f31643/pkg/cmd/delete/root.go#L43

provider := cluster.NewProvider(cluster.ProviderWithLogger(kind.KindLoggerFromLogr(&logger)), detectOpt)
if err := provider.Delete(name, ""); err != nil {
		return fmt.Errorf("failed to delete cluster %s: %w", name, err)
}

See also - kind delete function: https://github.com/kubernetes-sigs/kind/blob/main/pkg/cluster/internal/delete/delete.go#L27-L39

@cmoulliard cmoulliard added the enhancement New feature or request label Nov 22, 2024
@cmoulliard
Copy link
Contributor Author

I did a new test and the context is well removed from the kube config file even if we don't pass the path to access it as kind uses the default path in this case. podman ps has also been well removed !

So the only thing todo is to improve the code to let the users to provide their kubeconfig path

@punkwalker
Copy link
Contributor

@cmoulliard Is #362 similar to what you are expecting with kubeconfig path?

@cmoulliard
Copy link
Contributor Author

Is #362 similar to what you are expecting with kubeconfig path?

Yes. We will use such an issue to push a PR offering such a new kubeconfig path flag

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

No branches or pull requests

2 participants