mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
fix e2e/kubectl for gke
This commit is contained in:
parent
46e5ec3617
commit
1857aa0388
@ -275,6 +275,9 @@ func kubectlCmd(args ...string) *exec.Cmd {
|
|||||||
defaultArgs := []string{}
|
defaultArgs := []string{}
|
||||||
if testContext.KubeConfig != "" {
|
if testContext.KubeConfig != "" {
|
||||||
defaultArgs = append(defaultArgs, "--"+clientcmd.RecommendedConfigPathFlag+"="+testContext.KubeConfig)
|
defaultArgs = append(defaultArgs, "--"+clientcmd.RecommendedConfigPathFlag+"="+testContext.KubeConfig)
|
||||||
|
if testContext.KubeContext != "" {
|
||||||
|
defaultArgs = append(defaultArgs, "--"+clientcmd.FlagContext+"="+testContext.KubeContext)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
defaultArgs = append(defaultArgs, "--"+clientcmd.FlagAuthPath+"="+testContext.AuthConfig)
|
defaultArgs = append(defaultArgs, "--"+clientcmd.FlagAuthPath+"="+testContext.AuthConfig)
|
||||||
if testContext.CertDir != "" {
|
if testContext.CertDir != "" {
|
||||||
@ -285,10 +288,7 @@ func kubectlCmd(args ...string) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
kubectlArgs := append(defaultArgs, args...)
|
kubectlArgs := append(defaultArgs, args...)
|
||||||
// TODO: Remove this once gcloud writes a proper entry in the kubeconfig file.
|
|
||||||
if testContext.Provider == "gke" {
|
|
||||||
kubectlArgs = append(kubectlArgs, "--server="+testContext.Host)
|
|
||||||
}
|
|
||||||
//TODO: the "kubectl" path string might be worth externalizing into an (optional) ginko arg.
|
//TODO: the "kubectl" path string might be worth externalizing into an (optional) ginko arg.
|
||||||
cmd := exec.Command("kubectl", kubectlArgs...)
|
cmd := exec.Command("kubectl", kubectlArgs...)
|
||||||
Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
|
Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
|
||||||
|
Loading…
Reference in New Issue
Block a user