Closed PumpkinSeed closed 8 months ago
I'm not sure this is a good idea because we parse kubeconfig in a very particular way that preserves the YAML structure of the document etc which you probably don't need.
You should probably use https://pkg.go.dev/k8s.io/client-go/tools/clientcmd#NewDefaultClientConfigLoadingRules to load the kubeconfig and read the current-context.
Thanks for the answer. Yes, that's kinda make sense, but your implementation is way simpler only to get the context so I thought it worth a try.
It would be nice to let the internal/kubeconfig to be importable from different projects. This is so far the only package which can work with the kube config so it would be nice to use it from other projects. I ran into the issue, that I need the current context for one of my deployment and actual the deployment is written in Go.