mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #15875 from ashcrow/release-tar-fix-for-15713-15787
Auto commit by PR queue bot
This commit is contained in:
commit
c3d92de705
@ -26,6 +26,7 @@ import (
|
|||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
@ -197,8 +198,7 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// FIXME(ncdc) remove Skipped once we sort out the kubectl build issues in GCE
|
It("should support exec through an HTTP proxy", func() {
|
||||||
It("[Skipped] should support exec through an HTTP proxy", func() {
|
|
||||||
// Note: We are skipping local since we want to verify an apiserver with HTTPS.
|
// Note: We are skipping local since we want to verify an apiserver with HTTPS.
|
||||||
// At this time local only supports plain HTTP.
|
// At this time local only supports plain HTTP.
|
||||||
SkipIfProviderIs("local")
|
SkipIfProviderIs("local")
|
||||||
@ -206,33 +206,44 @@ var _ = Describe("Kubectl client", func() {
|
|||||||
if testContext.Host == "" {
|
if testContext.Host == "" {
|
||||||
Failf("--host variable must be set to the full URI to the api server on e2e run.")
|
Failf("--host variable must be set to the full URI to the api server on e2e run.")
|
||||||
}
|
}
|
||||||
apiServer := testContext.Host
|
|
||||||
// If there is no api in URL try to add it
|
|
||||||
if !strings.Contains(apiServer, ":443/api") {
|
|
||||||
apiServer = apiServer + ":443/api"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the kube/config
|
// Make sure the apiServer is set to what kubectl requires
|
||||||
// TODO: Can it be RepoRoot with jenkins e2e?
|
apiServer := testContext.Host
|
||||||
testWorkspace := os.Getenv("WORKSPACE")
|
apiServerUrl, err := url.Parse(apiServer)
|
||||||
if testWorkspace == "" {
|
if err != nil {
|
||||||
// Not running in jenkins, assume RepoRoot
|
Failf("Unable to parse URL %s. Error=%s", apiServer, err)
|
||||||
testWorkspace = testContext.RepoRoot // os.Getenv("HOME")
|
|
||||||
}
|
}
|
||||||
|
apiServerUrl.Scheme = "https"
|
||||||
|
apiServerUrl.Path = "/api"
|
||||||
|
if !strings.Contains(apiServer, ":443") {
|
||||||
|
apiServerUrl.Host = apiServerUrl.Host + ":443"
|
||||||
|
}
|
||||||
|
apiServer = apiServerUrl.String()
|
||||||
|
|
||||||
// Build the static kubectl
|
// Build the static kubectl
|
||||||
|
By("Finding a static kubectl for upload")
|
||||||
|
testStaticKubectlPath := path.Join(testContext.RepoRoot, "platforms/linux/386/kubectl")
|
||||||
|
_, err = os.Stat(testStaticKubectlPath)
|
||||||
|
if err != nil {
|
||||||
|
Logf("No kubectl in %s. Attempting a local build...", testStaticKubectlPath)
|
||||||
|
// Fall back to trying to build a local static kubectl
|
||||||
|
kubectlContainerPath := path.Join(testContext.RepoRoot, "/examples/kubectl-container/")
|
||||||
|
if _, err := os.Stat(path.Join(testContext.RepoRoot, "hack/build-go.sh")); err != nil {
|
||||||
|
Failf("Can't build static kubectl due to missing hack/build-go.sh. Error=%s", err)
|
||||||
|
}
|
||||||
By("Building a static kubectl for upload")
|
By("Building a static kubectl for upload")
|
||||||
kubectlContainerPath := path.Join(testWorkspace, "/examples/kubectl-container/")
|
|
||||||
staticKubectlBuild := exec.Command("make", "-C", kubectlContainerPath)
|
staticKubectlBuild := exec.Command("make", "-C", kubectlContainerPath)
|
||||||
if out, err := staticKubectlBuild.Output(); err != nil {
|
if out, err := staticKubectlBuild.Output(); err != nil {
|
||||||
Failf("Unable to create static kubectl. Error=%s, Output=%s", err, out)
|
Failf("Unable to create static kubectl. Error=%s, Output=%q", err, out)
|
||||||
}
|
}
|
||||||
// Verify the static kubectl path
|
// Verify the static kubectl path
|
||||||
testStaticKubectlPath := path.Join(kubectlContainerPath, "kubectl")
|
testStaticKubectlPath = path.Join(kubectlContainerPath, "kubectl")
|
||||||
_, err := os.Stat(testStaticKubectlPath)
|
_, err := os.Stat(testStaticKubectlPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("static kubectl path could not be accessed. Error=%s", err)
|
Failf("static kubectl path could not be found in %s. Error=%s", testStaticKubectlPath, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
By(fmt.Sprintf("Using the kubectl in %s", testStaticKubectlPath))
|
||||||
|
|
||||||
// Verify the kubeconfig path
|
// Verify the kubeconfig path
|
||||||
kubeConfigFilePath := testContext.KubeConfig
|
kubeConfigFilePath := testContext.KubeConfig
|
||||||
|
Loading…
Reference in New Issue
Block a user