From e605398fcfd9959c2fb7dab2096932482e949cc4 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 15 Nov 2016 21:05:23 -0500 Subject: [PATCH] Fix path to kubectl on host in kubectl-in-pod kubectl-in-pod.json has a hardcoded path for kubectl in its hostPath ('/usr/bin/kubectl'). When the test actually runs on gke, kubectl is available at '/workspace/kubernetes/platforms/linux/amd64/kubectl' and NOT at '/usr/bin/kubectl'. So we need to fix the hostPath for the test to work properly. Fixes #36586 --- test/e2e/kubectl.go | 9 ++++++++- test/e2e/testing-manifests/kubectl/kubectl-in-pod.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/e2e/kubectl.go b/test/e2e/kubectl.go index b4d275032b1..79ff98fa92c 100644 --- a/test/e2e/kubectl.go +++ b/test/e2e/kubectl.go @@ -566,8 +566,15 @@ var _ = framework.KubeDescribe("Kubectl client", func() { framework.SkipUnlessProviderIs("gke") nsFlag := fmt.Sprintf("--namespace=%v", ns) podJson := readTestFileOrDie(kubectlInPodFilename) + + // Replace the host path to kubectl in json + podString := strings.Replace(string(podJson), + "$KUBECTL_PATH", + framework.TestContext.KubectlPath, + 1) + By("validating api verions") - framework.RunKubectlOrDieInput(string(podJson), "create", "-f", "-", nsFlag) + framework.RunKubectlOrDieInput(podString, "create", "-f", "-", nsFlag) err := wait.PollImmediate(time.Second, time.Minute, func() (bool, error) { output := framework.RunKubectlOrDie("get", "pods/kubectl-in-pod", nsFlag) if strings.Contains(output, "Running") { diff --git a/test/e2e/testing-manifests/kubectl/kubectl-in-pod.json b/test/e2e/testing-manifests/kubectl/kubectl-in-pod.json index e4c4d76cd7e..c09777e0a05 100644 --- a/test/e2e/testing-manifests/kubectl/kubectl-in-pod.json +++ b/test/e2e/testing-manifests/kubectl/kubectl-in-pod.json @@ -20,7 +20,7 @@ ], "volumes": [{ "name":"kubectl", - "hostPath":{"path": "/usr/bin/kubectl"} + "hostPath":{"path": "$KUBECTL_PATH"} }] } }