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

k8s-context not cleaned up after terraform destroy #26

Open
tim-hilt opened this issue Feb 8, 2023 · 5 comments
Open

k8s-context not cleaned up after terraform destroy #26

tim-hilt opened this issue Feb 8, 2023 · 5 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@tim-hilt
Copy link

tim-hilt commented Feb 8, 2023

Shouldn't the k8s context be deleted after issuing terraform destroy? I can see that it's still there for me.

To reproduce:

  1. clone https://github.com/tim-hilt/lcb
  2. cd lcb
  3. terraform init
  4. terraform apply
  5. terraform destroy
  6. kubectl config get-contexts

You should still see, that the current context is kind-lcb.

@tehcyx
Copy link
Owner

tehcyx commented Feb 8, 2023

Shouldn't the k8s context be deleted after issuing terraform destroy? I can see that it's still there for me.

The only leftover should be an empty file. The content of the file is being deleted.

@tim-hilt
Copy link
Author

tim-hilt commented Feb 8, 2023

I adapted the description to add reproduction steps. Is this behavior expected?

@tehcyx
Copy link
Owner

tehcyx commented Feb 8, 2023

I'll have to dig a little bit into that. This might be kind itself, or the provider not calling a cleanup function on kind. Since the provider itself does not create the context, this is handled by invoking kind.

Thanks for adding the steps to reproduce.

@tehcyx tehcyx self-assigned this Feb 9, 2023
@tehcyx tehcyx added the good first issue Good for newcomers label Feb 9, 2023
@tim-hilt
Copy link
Author

tim-hilt commented Feb 9, 2023

I tried destroying the kind-cluster with kind delete cluster --name lcb and it also removed the k8s-context. No idea about the Go sdk though

@tehcyx
Copy link
Owner

tehcyx commented Feb 13, 2023

I can reproduce it, still figuring out how to best delete the context. kind, minikube and other tools all have their own kubeconfig wrapper, see e.g. here: https://github.com/anencore94/minikube/blob/2c08f62ed21489cfd5db89289b4306b84b39868d/pkg/minikube/kubeconfig/context.go#L66

Wondering how I could delete the context without implementing my own wrapper. kind is packing it into an internal package, though I'm already using one internal package of kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants