Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Use KUBECONFIG env variable if present #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sandipb
Copy link

@sandipb sandipb commented May 27, 2022

No description provided.

@xmcqueen
Copy link
Contributor

I'm not sure about the problem you are seeing, because I do this kind of thing in testing and it works as-is:

KUBECONFIG=~/.kube/config ./kubernetes-event-exporter -conf k23r-stdout.yaml

So it does seem to honor the KUBECONFIG at least in regard to finding the kubeconfig used to setup the event watcher. I think the machinery for that is built into the upstream client-go code.

@sandipb
Copy link
Author

sandipb commented Jun 26, 2022

You are using the default KUBECONFIG. Even if you dont set that env variable, that will work. However, if your KUBECONFIG is anything other that the default path, it will not work. You can look at the part of the code I am changing. Currently, it reads the path you are mentioning anyway:

return clientcmd.BuildConfigFromFlags("", filepath.Join(os.Getenv("HOME"), ".kube", "config"))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants