[Go] shouldn't use XDG_CACHE_HOME for reading kubeconfigs
Author: ahmetbCreated Jul 10, 2020Updated Oct 21, 2024
LabelsBugGo implementation
bash based implementations used something like KUBECTX="${XDG_CACHE_HOME:-$HOME/.kube}/kubectx" to determine where the "state files" are stored.
XDG_CACHE_HOME is good for that kinda stuff.
However with the Go implementations, that path is also used for determining where the $KUBECONFIG file is at by default –which is not correct. client-go default config loading rules don't read XDG_ env vars.
This only impacts users who had a XDG_CACHE_HOME set. If they did so, we'll look for the kubeconfig at $XDG_CACHE_HOME/.kube/config and not $HOME/.kube/config which is a bug.
Source: ahmetb/kubectx