-
Notifications
You must be signed in to change notification settings - Fork 172
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
Check for a $KUBECONFIG env-variable #316
Conversation
It would be swell to see some type of test for this. Like maybe move the k3s kube config and set the env variable. |
// use the current context in the default kubeconfig in the home path of the user | ||
homePath, err := os.UserHomeDir() | ||
if err != nil { | ||
message.Fatal(nil, "Unable to load the current user's home directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the latest on doing this vs returning error
? I thought at some point I had heard @jeff-mccoy say we were switching to returning error
to make testing easier.
Though, I'm seeing right below this it doing the same thing, so maybe the question is whether a refactor of this method is warranted along with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are moving towards bubbling errors, but that would be a larger refactor than this code right now, so I think this one is okay.
/test all |
e5f1c04
to
5bd8bcd
Compare
/test all |
/test all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
// use the current context in the default kubeconfig in the home path of the user | ||
homePath, err := os.UserHomeDir() | ||
if err != nil { | ||
message.Fatal(nil, "Unable to load the current user's home directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are moving towards bubbling errors, but that would be a larger refactor than this code right now, so I think this one is okay.
This PR adds a check for the $KUBECONFIG environment variable when Zarf is trying to generate a config to talk to a native kubernetes cluster.
Closes #315