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

Use KUBECONFIG env variable if present#199

Open
sandipb wants to merge 1 commit into
opsgenie:masterfrom
sandipb:use_kubeconfig_env
Open

Use KUBECONFIG env variable if present#199
sandipb wants to merge 1 commit into
opsgenie:masterfrom
sandipb:use_kubeconfig_env

Conversation

@sandipb

@sandipb sandipb commented May 27, 2022

Copy link
Copy Markdown

No description provided.

@xmcqueen

Copy link
Copy Markdown
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

sandipb commented Jun 26, 2022

Copy link
Copy Markdown
Author

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