terraform-provider-kind
terraform-provider-kind copied to clipboard
k8s-context not cleaned up after terraform destroy
Shouldn't the k8s context be deleted after issuing terraform destroy
? I can see that it's still there for me.
To reproduce:
- clone https://github.com/tim-hilt/lcb
- cd lcb
- terraform init
- terraform apply
- terraform destroy
- kubectl config get-contexts
You should still see, that the current context is kind-lcb.
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.
I adapted the description to add reproduction steps. Is this behavior expected?
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.
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
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.