Skip to content

Commit

Permalink
Fix path to kubectl on host in kubectl-in-pod
Browse files Browse the repository at this point in the history
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 kubernetes#36586
  • Loading branch information
dims committed Nov 16, 2016
1 parent fedf178 commit e605398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion test/e2e/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/testing-manifests/kubectl/kubectl-in-pod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"volumes": [{
"name":"kubectl",
"hostPath":{"path": "/usr/bin/kubectl"}
"hostPath":{"path": "$KUBECTL_PATH"}
}]
}
}

0 comments on commit e605398

Please sign in to comment.