Skip to content
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

Fix path to kubectl on host in kubectl-in-pod #36864

Merged
merged 1 commit into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dims If flag kubectl-path is not set, framework.TestContext.KubectlPath may be an empty string, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wrong.
It seems you default kubectl-path to kubectl.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ymqytw : then a lot more stuff would break -

cmd := exec.Command(TestContext.KubectlPath, kubectlArgs...)

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"}
}]
}
}