From 930291588cdf9cc571348f7e4166f597804a91cf Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Wed, 24 Feb 2016 13:08:22 -0800 Subject: [PATCH] Remove PrepareVersion from hack/e2e.go. --- docs/devel/e2e-tests.md | 3 - hack/e2e-internal/build-release.sh | 5 +- hack/e2e-internal/e2e-cluster-size.sh | 5 +- hack/e2e-internal/e2e-down.sh | 5 +- hack/e2e-internal/e2e-push.sh | 7 +-- hack/e2e-internal/e2e-status.sh | 5 +- hack/e2e-internal/e2e-up.sh | 5 +- hack/e2e-internal/e2e-upgrade.sh | 7 +-- hack/e2e.go | 83 +-------------------------- hack/ginkgo-e2e.sh | 7 +-- 10 files changed, 22 insertions(+), 110 deletions(-) diff --git a/docs/devel/e2e-tests.md b/docs/devel/e2e-tests.md index 0c75af705c2..bc1e7184958 100644 --- a/docs/devel/e2e-tests.md +++ b/docs/devel/e2e-tests.md @@ -63,9 +63,6 @@ go run hack/e2e.go -v --build # Create a fresh cluster. Deletes a cluster first, if it exists go run hack/e2e.go -v --up -# Create a fresh cluster at a specific release version. -go run hack/e2e.go -v --up --version=0.7.0 - # Test if a cluster is up. go run hack/e2e.go -v --isup diff --git a/hack/e2e-internal/build-release.sh b/hack/e2e-internal/build-release.sh index a27333d9419..1a3d2ad49df 100755 --- a/hack/e2e-internal/build-release.sh +++ b/hack/e2e-internal/build-release.sh @@ -20,14 +20,13 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e diff --git a/hack/e2e-internal/e2e-cluster-size.sh b/hack/e2e-internal/e2e-cluster-size.sh index 9e2149d9f7f..1ccbdeac25e 100755 --- a/hack/e2e-internal/e2e-cluster-size.sh +++ b/hack/e2e-internal/e2e-cluster-size.sh @@ -20,14 +20,13 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e diff --git a/hack/e2e-internal/e2e-down.sh b/hack/e2e-internal/e2e-down.sh index cf56a7f5ed5..5bcda502778 100755 --- a/hack/e2e-internal/e2e-down.sh +++ b/hack/e2e-internal/e2e-down.sh @@ -20,14 +20,13 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e diff --git a/hack/e2e-internal/e2e-push.sh b/hack/e2e-internal/e2e-push.sh index ba1d4c486d8..10433997945 100755 --- a/hack/e2e-internal/e2e-push.sh +++ b/hack/e2e-internal/e2e-push.sh @@ -20,15 +20,14 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e -"${KUBE_VERSION_ROOT}/cluster/kube-push.sh" $@ +"${KUBE_ROOT}/cluster/kube-push.sh" $@ diff --git a/hack/e2e-internal/e2e-status.sh b/hack/e2e-internal/e2e-status.sh index 4dcf4503ba8..d67baad35d2 100755 --- a/hack/e2e-internal/e2e-status.sh +++ b/hack/e2e-internal/e2e-status.sh @@ -20,14 +20,13 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e diff --git a/hack/e2e-internal/e2e-up.sh b/hack/e2e-internal/e2e-up.sh index 888b6227107..f60996ab47c 100755 --- a/hack/e2e-internal/e2e-up.sh +++ b/hack/e2e-internal/e2e-up.sh @@ -20,14 +20,13 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e diff --git a/hack/e2e-internal/e2e-upgrade.sh b/hack/e2e-internal/e2e-upgrade.sh index aacd9cbc5e2..2097f3e11c3 100755 --- a/hack/e2e-internal/e2e-upgrade.sh +++ b/hack/e2e-internal/e2e-upgrade.sh @@ -20,15 +20,14 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:=${KUBE_VERSION_ROOT}/cluster/kubectl.sh} +: ${KUBECTL:=${KUBE_ROOT}/cluster/kubectl.sh} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" +source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e -"${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/upgrade.sh" $@ +"${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/upgrade.sh" $@ diff --git a/hack/e2e.go b/hack/e2e.go index 9ddc34a9734..61468797ad3 100644 --- a/hack/e2e.go +++ b/hack/e2e.go @@ -19,10 +19,7 @@ package main import ( "flag" - "fmt" - "io" "log" - "net/http" "os" "os/exec" "path" @@ -35,7 +32,6 @@ import ( var ( isup = flag.Bool("isup", false, "Check to see if the e2e cluster is up, then exit.") build = flag.Bool("build", false, "If true, build a new release. Otherwise, use whatever is there.") - version = flag.String("version", "", "The version to be tested (including the leading 'v'). An empty string defaults to the local build, but it can be set to any release (e.g. v0.4.4, v0.6.0).") up = flag.Bool("up", false, "If true, start the the e2e cluster. If cluster is already up, recreate it.") push = flag.Bool("push", false, "If true, push to e2e cluster. Has no effect if -up is true.") pushup = flag.Bool("pushup", false, "If true, push to e2e cluster if it's up, otherwise start the e2e cluster.") @@ -53,18 +49,7 @@ var ( ) const ( - serverTarName = "kubernetes-server-linux-amd64.tar.gz" - saltTarName = "kubernetes-salt.tar.gz" - downloadDirName = "_output/downloads" - tarDirName = "server" - tempDirName = "upgrade-e2e-temp-dir" - minNodeCount = 2 -) - -var ( - // Root directory of the specified cluster version, rather than of where - // this script is being run from. - versionRoot = *root + minNodeCount = 2 ) func absOrDie(path string) string { @@ -107,21 +92,7 @@ func main() { } } - if *version != "" { - // If the desired version isn't available already, do whatever's needed - // to make it available. Once done, update the root directory for client - // tools to be the root of the release directory so that the given - // release's tools will be used. We can't use this new root for - // everything because it likely doesn't have the hack/ directory in it. - if newVersionRoot, err := PrepareVersion(*version); err != nil { - log.Fatalf("Error preparing a binary of version %s: %s. Aborting.", *version, err) - } else { - versionRoot = newVersionRoot - os.Setenv("KUBE_VERSION_ROOT", newVersionRoot) - } - } - - os.Setenv("KUBECTL", versionRoot+`/cluster/kubectl.sh`+kubectlArgs()) + os.Setenv("KUBECTL", *root+`/cluster/kubectl.sh`+kubectlArgs()) os.Setenv("KUBE_TEST_DEBUG", "y") if *pushup { @@ -150,7 +121,7 @@ func main() { case *ctlCmd != "": ctlArgs := strings.Fields(*ctlCmd) os.Setenv("KUBE_CONFIG_FILE", "config-test.sh") - success = finishRunning("'kubectl "+*ctlCmd+"'", exec.Command(path.Join(versionRoot, "cluster/kubectl.sh"), ctlArgs...)) + success = finishRunning("'kubectl "+*ctlCmd+"'", exec.Command(path.Join(*root, "cluster/kubectl.sh"), ctlArgs...)) case *test: success = Test() } @@ -206,54 +177,6 @@ func IsUp() bool { return finishRunning("get status", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-status.sh"))) } -// PrepareVersion makes sure that the specified release version is locally -// available and ready to be used by kube-up or kube-push. Returns the director -// path of the release. -func PrepareVersion(version string) (string, error) { - if version == "" { - // Assume that the build flag already handled building a local binary. - return *root, nil - } - - // If the version isn't a local build, try fetching the release from Google - // Cloud Storage. - downloadDir := filepath.Join(*root, downloadDirName) - if err := os.MkdirAll(downloadDir, 0755); err != nil { - return "", err - } - localReleaseDir := filepath.Join(downloadDir, version) - if err := os.MkdirAll(localReleaseDir, 0755); err != nil { - return "", err - } - - remoteReleaseTar := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/%s/kubernetes.tar.gz", version) - localReleaseTar := filepath.Join(downloadDir, fmt.Sprintf("kubernetes-%s.tar.gz", version)) - if _, err := os.Stat(localReleaseTar); os.IsNotExist(err) { - out, err := os.Create(localReleaseTar) - if err != nil { - return "", err - } - resp, err := http.Get(remoteReleaseTar) - if err != nil { - out.Close() - return "", err - } - defer resp.Body.Close() - io.Copy(out, resp.Body) - if err != nil { - out.Close() - return "", err - } - out.Close() - } - if !finishRunning("untarRelease", exec.Command("tar", "-C", localReleaseDir, "-zxf", localReleaseTar, "--strip-components=1")) { - log.Fatal("Failed to untar release. Aborting.") - } - // Now that we have the binaries saved locally, use the path to the untarred - // directory as the "root" path for future operations. - return localReleaseDir, nil -} - func Test() bool { if !IsUp() { log.Fatal("Testing requested, but e2e cluster not up!") diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index 123c594e53f..143c7b4e43a 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -33,8 +33,7 @@ e2e_test=$(kube::util::find-binary "e2e.test") # --- Setup some env vars. -: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}} -: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"} +: ${KUBECTL:="${KUBE_ROOT}/cluster/kubectl.sh"} : ${KUBE_CONFIG_FILE:="config-test.sh"} export KUBECTL KUBE_CONFIG_FILE @@ -54,7 +53,7 @@ if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then else echo "Setting up for KUBERNETES_PROVIDER=\"${KUBERNETES_PROVIDER}\"." - source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" + source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh" prepare-e2e @@ -103,7 +102,7 @@ export PATH=$(dirname "${e2e_test}"):"${PATH}" --gke-cluster="${CLUSTER_NAME:-}" \ --kube-master="${KUBE_MASTER:-}" \ --cluster-tag="${CLUSTER_ID:-}" \ - --repo-root="${KUBE_VERSION_ROOT}" \ + --repo-root="${KUBE_ROOT}" \ --node-instance-group="${NODE_INSTANCE_GROUP:-}" \ --num-nodes="${NUM_NODES:-}" \ --prefix="${KUBE_GCE_INSTANCE_PREFIX:-e2e}" \