-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Standalone kubeconfig for gce kube-up #5154
Conversation
fmt.Printf(">>> testContext.kubeConfig: %s\n", testContext.kubeConfig) | ||
c, err := clientcmd.LoadFromFile(testContext.kubeConfig) | ||
if err != nil { | ||
return nil, fmt.Errorf("Error loading kubeConfig: %v", err.Error()) |
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.
How about starting returned error messages with a lower case letter?
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.
Done.
@filbranden because he always has an opinion on bash code :-) |
Great, thanks. I think it is good to remove information about deleted clusters to avoid confusion for users (like me) who look at these files and then make assumptions about what exists in the real world. Also, it's also great to be able to copy a config file from my Ubuntu desktop to my MacBook Pro and carry on where I left off. |
"${kubectl}" config unset "users.${CONTEXT}" | ||
"${kubectl}" config unset "contexts.${CONTEXT}" | ||
|
||
local current=$("${kubectl}" config view -o template --template='{{ index . "current-context" }}') |
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.
There's a problem with the interaction of local
with $(...)
in that the local
will "hide" the error status of the command being replaced here.
For example this function will not fail under errexit
as expected:
set -o errexit
function should_fail() {
local failure=$(false)
}
Recommendation is to split the local and the assignment instead:
local current
current=$("${kubectl}" config view -o template --template='{{ index . "current-context" }}')
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.
Done.
Also tweaked the ginkgo tests to pull auth directly from a kubeconfig file instead of the legacy kubernetes_auth file.
PTAL |
@filbranden : want to give a LGTM for the bash? |
Yes, LGTM, that was my only comment. Thanks for addressing it! |
Standalone kubeconfig for gce kube-up
Make gce create and clear standalone
.kubeconfig
(embedded certs) onkube-up
,kube-down
respectively. Also updated e2e test driver to pull auth info from either a.kubeconfig
file or a.kubernetes_auth
with optional certs directory.This closes #5040, and enables the following workflow
kube-up.sh
$HOME/.kube/.kubeconfig
to host2e2e tests passing on gce, gke. cc @zmerlynn, @satnam6502