Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.loadConfig Breaking Change introduced in 0.4.0 #748

Closed
edwardecook opened this issue Jan 6, 2020 · 7 comments · Fixed by #753
Closed

config.loadConfig Breaking Change introduced in 0.4.0 #748

edwardecook opened this issue Jan 6, 2020 · 7 comments · Fixed by #753
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.

Comments

@edwardecook
Copy link

edwardecook commented Jan 6, 2020

As part of 840ac8a there was a switch for the fallback behaviour of config.loadConfig (when not specifying via flag, env var or internal config) from identifying the default home directory with os/user to the k8s.io/client-go/util/homedir package (called via clientcmd.NewDefaultClientConfigLoadingRules()).

This has the effect of switching from grabbing the os home config to relying on the HOME env var to be set which is not always the case.

This is not listed as a breaking change within the v0.4.0 release notes however it will effect anyone using the GetConfig or GetConfigOrDie functions.

Let me know if there are any other details needed!

Cheers

cc @gmrodgers

@DirectXMan12
Copy link
Contributor

Thanks so much for reporting this!

I'll add it to the release notes. In the mean time, I think this is an unintended regression, and we might want to fix it (although I suspect this brings us in line with what kubectl does, so maybe not that bad?)

cc @joelanford who authored that change.

Out of curiosity, what are the cases where $HOME isn't set?

@DirectXMan12
Copy link
Contributor

/kind bug
/priority critical-urgent
/kind regression

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Jan 6, 2020
@k8s-ci-robot
Copy link
Contributor

@DirectXMan12: The label(s) kind/regression cannot be applied, because the repository doesn't have them

In response to this:

/kind bug
/priority critical-urgent
/kind regression

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@DirectXMan12
Copy link
Contributor

release notes updated

@edwardecook
Copy link
Author

Cheers for the speedy response!

$HOME isn't set when running an external command via the os/exec package, for instance exec.Command(binPath).Start() which is how we run a controller as part of acceptance testing.

@joelanford
Copy link
Member

Good catch @edwardecook!

It seems like a quick fix could be to check if $HOME is set, and if not, use the original method to set it, which would then allow the rest of the clientcmd code to work as is. Or alternatively, as @DirectXMan12 mentioned, the current implementation is likely more in line with other components that use client-go, so I could see an argument to leave it as is.

Thoughts @DirectXMan12?

@DirectXMan12
Copy link
Contributor

I'd lean towards detecting if $HOME is empty and, if so, falling back to user.Current. I think upstream should probably do that too, but that's a story for another day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
4 participants