mirror of https://github.com/k3s-io/k3s
Upgrades and upgrade tests take versions of the form release/stable instead of stable_release:
- Refactor common and gce/upgrade.sh to use arbitrary published releases - Update hack/get-build to use cluster/common code - Use hack/get-build.sh in cluster upgrade test logicpull/6/head
parent
e929977ff3
commit
60c316b54a
|
@ -24,6 +24,13 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
|
|
||||||
DEFAULT_KUBECONFIG="${HOME}/.kube/config"
|
DEFAULT_KUBECONFIG="${HOME}/.kube/config"
|
||||||
|
|
||||||
|
# KUBE_VERSION_REGEX matches things like "v1.2.3"
|
||||||
|
KUBE_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
||||||
|
|
||||||
|
# KUBE_CI_VERSION_REGEX matches things like "v1.2.3-alpha.4.56+abcdefg"
|
||||||
|
KUBE_CI_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-(.*)$"
|
||||||
|
|
||||||
|
|
||||||
# Generate kubeconfig data for the created cluster.
|
# Generate kubeconfig data for the created cluster.
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# KUBE_USER
|
# KUBE_USER
|
||||||
|
@ -224,23 +231,20 @@ function detect-master-from-kubeconfig() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets KUBE_VERSION variable to the version passed in as an argument, or if argument is
|
# Sets KUBE_VERSION variable to the proper version number (e.g. "v1.0.6",
|
||||||
# latest_stable, latest_release, or latest_ci fetches and sets the corresponding version number
|
# "v1.2.0-alpha.1.881+376438b69c7612") or a version' publication of the form
|
||||||
|
# <bucket>/<version> (e.g. "release/stable",' "ci/latest-1").
|
||||||
|
#
|
||||||
|
# See the docs on getting builds for more information about version
|
||||||
|
# publication.
|
||||||
#
|
#
|
||||||
# Args:
|
# Args:
|
||||||
# $1 version string from command line
|
# $1 version string from command line
|
||||||
# Vars set:
|
# Vars set:
|
||||||
# KUBE_VERSION
|
# KUBE_VERSION
|
||||||
function set_binary_version() {
|
function set_binary_version() {
|
||||||
if [[ "${1}" == "latest_stable" ]]; then
|
if [[ "${1}" =~ "/" ]]; then
|
||||||
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/release/stable.txt)
|
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/${1}.txt)
|
||||||
echo "Using latest stable version: ${KUBE_VERSION}" >&2
|
|
||||||
elif [[ "${1}" == "latest_release" ]]; then
|
|
||||||
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/release/latest.txt)
|
|
||||||
echo "Using latest release version: ${KUBE_VERSION}" >&2
|
|
||||||
elif [[ "${1}" == "latest_ci" ]]; then
|
|
||||||
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/ci/latest.txt)
|
|
||||||
echo "Using latest ci version: ${KUBE_VERSION}" >&2
|
|
||||||
else
|
else
|
||||||
KUBE_VERSION=${1}
|
KUBE_VERSION=${1}
|
||||||
fi
|
fi
|
||||||
|
@ -251,8 +255,11 @@ function set_binary_version() {
|
||||||
# use local dev binaries.
|
# use local dev binaries.
|
||||||
#
|
#
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# PROJECT
|
# KUBE_VERSION_REGEX
|
||||||
|
# KUBE_CI_VERSION_REGEX
|
||||||
# Vars set:
|
# Vars set:
|
||||||
|
# KUBE_TAR_URL
|
||||||
|
# KUBE_TAR_HASH
|
||||||
# SERVER_BINARY_TAR_URL
|
# SERVER_BINARY_TAR_URL
|
||||||
# SERVER_BINARY_TAR_HASH
|
# SERVER_BINARY_TAR_HASH
|
||||||
# SALT_TAR_URL
|
# SALT_TAR_URL
|
||||||
|
@ -262,15 +269,20 @@ function tars_from_version() {
|
||||||
find-release-tars
|
find-release-tars
|
||||||
upload-server-tars
|
upload-server-tars
|
||||||
elif [[ ${KUBE_VERSION} =~ ${KUBE_VERSION_REGEX} ]]; then
|
elif [[ ${KUBE_VERSION} =~ ${KUBE_VERSION_REGEX} ]]; then
|
||||||
|
KUBE_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes.tar.gz"
|
||||||
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
|
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
|
||||||
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-salt.tar.gz"
|
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-salt.tar.gz"
|
||||||
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
|
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
|
||||||
|
KUBE_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes.tar.gz"
|
||||||
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
|
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
|
||||||
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-salt.tar.gz"
|
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-salt.tar.gz"
|
||||||
else
|
else
|
||||||
echo "Version doesn't match regexp" >&2
|
echo "Version doesn't match regexp" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
until KUBE_TAR_HASH=$(curl --fail --silent "${KUBE_TAR_URL}.sha1"); do
|
||||||
|
echo "Failure trying to curl release .sha1"
|
||||||
|
done
|
||||||
until SERVER_BINARY_TAR_HASH=$(curl --fail --silent "${SERVER_BINARY_TAR_URL}.sha1"); do
|
until SERVER_BINARY_TAR_HASH=$(curl --fail --silent "${SERVER_BINARY_TAR_URL}.sha1"); do
|
||||||
echo "Failure trying to curl release .sha1"
|
echo "Failure trying to curl release .sha1"
|
||||||
done
|
done
|
||||||
|
@ -278,6 +290,10 @@ function tars_from_version() {
|
||||||
echo "Failure trying to curl Salt tar .sha1"
|
echo "Failure trying to curl Salt tar .sha1"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! curl -Ss --range 0-1 "${KUBE_TAR_URL}" >&/dev/null; then
|
||||||
|
echo "Can't find release at ${KUBE_TAR_URL}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if ! curl -Ss --range 0-1 "${SERVER_BINARY_TAR_URL}" >&/dev/null; then
|
if ! curl -Ss --range 0-1 "${SERVER_BINARY_TAR_URL}" >&/dev/null; then
|
||||||
echo "Can't find release at ${SERVER_BINARY_TAR_URL}" >&2
|
echo "Can't find release at ${SERVER_BINARY_TAR_URL}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -34,29 +34,38 @@ source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||||
function usage() {
|
function usage() {
|
||||||
echo "!!! EXPERIMENTAL !!!"
|
echo "!!! EXPERIMENTAL !!!"
|
||||||
echo ""
|
echo ""
|
||||||
echo "${0} [-M|-N|-P] -l | <release or continuous integration version> | [latest_stable|latest_release|latest_ci]"
|
echo "${0} [-M|-N|-P] -l | <version number or publication>"
|
||||||
echo " Upgrades master and nodes by default"
|
echo " Upgrades master and nodes by default"
|
||||||
echo " -M: Upgrade master only"
|
echo " -M: Upgrade master only"
|
||||||
echo " -N: Upgrade nodes only"
|
echo " -N: Upgrade nodes only"
|
||||||
echo " -P: Node upgrade prerequisites only (create a new instance template)"
|
echo " -P: Node upgrade prerequisites only (create a new instance template)"
|
||||||
echo " -l: Use local(dev) binaries"
|
echo " -l: Use local(dev) binaries"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo ' Version number or publication is either a proper version number'
|
||||||
|
echo ' (e.g. "v1.0.6", "v1.2.0-alpha.1.881+376438b69c7612") or a version'
|
||||||
|
echo ' publication of the form <bucket>/<version> (e.g. "release/stable",'
|
||||||
|
echo ' "ci/latest-1"). Some common ones are:'
|
||||||
|
echo ' - "release/stable"'
|
||||||
|
echo ' - "release/latest"'
|
||||||
|
echo ' - "ci/latest"'
|
||||||
|
echo ' See the docs on getting builds for more information about version publication.'
|
||||||
|
echo ""
|
||||||
echo "(... Fetching current release versions ...)"
|
echo "(... Fetching current release versions ...)"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# NOTE: IF YOU CHANGE THE FOLLOWING LIST, ALSO UPDATE test/e2e/cluster_upgrade.go
|
# NOTE: IF YOU CHANGE THE FOLLOWING LIST, ALSO UPDATE test/e2e/cluster_upgrade.go
|
||||||
local latest_release
|
local release_stable
|
||||||
local latest_stable
|
local release_latest
|
||||||
local latest_ci
|
local ci_latest
|
||||||
|
|
||||||
latest_stable=$(gsutil cat gs://kubernetes-release/release/stable.txt)
|
release_stable=$(gsutil cat gs://kubernetes-release/release/stable.txt)
|
||||||
latest_release=$(gsutil cat gs://kubernetes-release/release/latest.txt)
|
release_latest=$(gsutil cat gs://kubernetes-release/release/latest.txt)
|
||||||
latest_ci=$(gsutil cat gs://kubernetes-release/ci/latest.txt)
|
ci_latest=$(gsutil cat gs://kubernetes-release/ci/latest.txt)
|
||||||
|
|
||||||
echo "To upgrade to:"
|
echo "Right now, versions are as follows:"
|
||||||
echo " latest stable: ${0} ${latest_stable}"
|
echo " release/stable: ${0} ${release_stable}"
|
||||||
echo " latest release: ${0} ${latest_release}"
|
echo " release/latest: ${0} ${release_latest}"
|
||||||
echo " latest ci: ${0} ${latest_ci}"
|
echo " ci/latest: ${0} ${ci_latest}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade-master() {
|
function upgrade-master() {
|
||||||
|
|
|
@ -42,13 +42,6 @@ KUBE_GCS_STAGING_PATH_SUFFIX=${KUBE_GCS_STAGING_PATH_SUFFIX-""}
|
||||||
# How long (in seconds) to wait for cluster initialization.
|
# How long (in seconds) to wait for cluster initialization.
|
||||||
KUBE_CLUSTER_INITIALIZATION_TIMEOUT=${KUBE_CLUSTER_INITIALIZATION_TIMEOUT:-300}
|
KUBE_CLUSTER_INITIALIZATION_TIMEOUT=${KUBE_CLUSTER_INITIALIZATION_TIMEOUT:-300}
|
||||||
|
|
||||||
# VERSION_REGEX matches things like "v0.13.1"
|
|
||||||
readonly KUBE_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
||||||
|
|
||||||
# CI_VERSION_REGEX matches things like "v0.14.1-341-ge0c9d9e"
|
|
||||||
readonly KUBE_CI_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-(.*)$"
|
|
||||||
|
|
||||||
|
|
||||||
function join_csv {
|
function join_csv {
|
||||||
local IFS=','; echo "$*";
|
local IFS=','; echo "$*";
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,16 +74,7 @@ The node upgrade process is user-initiated and is described in the [GKE document
|
||||||
|
|
||||||
Upgrades on open source Google Compute Engine (GCE) clusters are controlled by the `cluster/gce/upgrade.sh` script.
|
Upgrades on open source Google Compute Engine (GCE) clusters are controlled by the `cluster/gce/upgrade.sh` script.
|
||||||
|
|
||||||
Its usage is as follows:
|
Get its usage by running `cluster/gce/upgrade.sh -h`.
|
||||||
|
|
||||||
```console
|
|
||||||
cluster/gce/upgrade.sh [-M|-N|-P] -l | <release or continuous integration version> | [latest_stable|latest_release|latest_ci]
|
|
||||||
Upgrades master and nodes by default
|
|
||||||
-M: Upgrade master only
|
|
||||||
-N: Upgrade nodes only
|
|
||||||
-P: Node upgrade prerequisites only (create a new instance template)
|
|
||||||
-l: Use local(dev) binaries
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, to upgrade just your master to a specific version (v1.0.2):
|
For example, to upgrade just your master to a specific version (v1.0.2):
|
||||||
|
|
||||||
|
@ -94,7 +85,7 @@ cluster/gce/upgrade.sh -M v1.0.2
|
||||||
Alternatively, to upgrade your entire cluster to the latest stable release:
|
Alternatively, to upgrade your entire cluster to the latest stable release:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
cluster/gce/upgrade.sh latest_stable
|
cluster/gce/upgrade.sh release/stable
|
||||||
```
|
```
|
||||||
|
|
||||||
### Other platforms
|
### Other platforms
|
||||||
|
|
|
@ -35,17 +35,27 @@ Documentation for other releases can be found at
|
||||||
|
|
||||||
You can use [hack/get-build.sh](http://releases.k8s.io/HEAD/hack/get-build.sh) to or use as a reference on how to get the most recent builds with curl. With `get-build.sh` you can grab the most recent stable build, the most recent release candidate, or the most recent build to pass our ci and gce e2e tests (essentially a nightly build).
|
You can use [hack/get-build.sh](http://releases.k8s.io/HEAD/hack/get-build.sh) to or use as a reference on how to get the most recent builds with curl. With `get-build.sh` you can grab the most recent stable build, the most recent release candidate, or the most recent build to pass our ci and gce e2e tests (essentially a nightly build).
|
||||||
|
|
||||||
```console
|
Run `./hack/get-build.sh -h` for its usage.
|
||||||
usage:
|
|
||||||
./hack/get-build.sh [stable|release|latest|latest-green]
|
|
||||||
|
|
||||||
stable: latest stable version
|
For example, to get a build at a specific version (v1.0.2):
|
||||||
release: latest release candidate
|
|
||||||
latest: latest ci build
|
```console
|
||||||
latest-green: latest ci build to pass gce e2e
|
./hack/get-build.sh v1.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use the gsutil tool to explore the Google Cloud Storage release bucket. Here are some examples:
|
Alternatively, to get the latest stable release:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./hack/get-build.sh release/stable
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, you can just print the latest or stable version:
|
||||||
|
|
||||||
|
```console
|
||||||
|
./hack/get-build.sh -v ci/latest
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the gsutil tool to explore the Google Cloud Storage release buckets. Here are some examples:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
gsutil cat gs://kubernetes-release/ci/latest.txt # output the latest ci version number
|
gsutil cat gs://kubernetes-release/ci/latest.txt # output the latest ci version number
|
||||||
|
|
|
@ -18,53 +18,59 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
|
|
||||||
|
source "${KUBE_ROOT}/cluster/common.sh"
|
||||||
|
|
||||||
declare -r KUBE_RELEASE_BUCKET_URL="https://storage.googleapis.com/kubernetes-release"
|
declare -r KUBE_RELEASE_BUCKET_URL="https://storage.googleapis.com/kubernetes-release"
|
||||||
declare -r KUBE_TAR_NAME="kubernetes.tar.gz"
|
declare -r KUBE_TAR_NAME="kubernetes.tar.gz"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage:
|
echo "${0} [-v] <version number or publication>"
|
||||||
$0 [stable|release|latest|latest-green]
|
echo " -v: Don't get tars, just print the version number"
|
||||||
|
echo ""
|
||||||
stable: latest stable version
|
echo ' Version number or publication is either a proper version number'
|
||||||
release: latest release candidate
|
echo ' (e.g. "v1.0.6", "v1.2.0-alpha.1.881+376438b69c7612") or a version'
|
||||||
latest: latest ci build
|
echo ' publication of the form <bucket>/<version> (e.g. "release/stable",'
|
||||||
latest-green: latest ci build to pass gce e2e"
|
echo ' "ci/latest-1"). Some common ones are:'
|
||||||
|
echo ' - "release/stable"'
|
||||||
|
echo ' - "release/latest"'
|
||||||
|
echo ' - "ci/latest"'
|
||||||
|
echo ' See the docs on getting builds for more information about version'
|
||||||
|
echo ' publication.'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_version=false
|
||||||
|
|
||||||
|
while getopts ":vh" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
v)
|
||||||
|
print_version="true"
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
if [[ $# -ne 1 ]]; then
|
if [[ $# -ne 1 ]]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
set_binary_version ${1}
|
||||||
"latest")
|
|
||||||
# latest ci version is written in the latest.txt in the /ci dir
|
|
||||||
KUBE_TAR_RELATIVE_PATH="ci"
|
|
||||||
KUBE_VERSION_FILE="latest.txt"
|
|
||||||
;;
|
|
||||||
"latest-green")
|
|
||||||
# latest ci version to pass gce e2e is written in the latest-green.txt in the /ci dir
|
|
||||||
KUBE_TAR_RELATIVE_PATH="ci"
|
|
||||||
KUBE_VERSION_FILE="latest-green.txt"
|
|
||||||
;;
|
|
||||||
"stable")
|
|
||||||
# latest stable release version is written in the stable.txt file in the /release dir
|
|
||||||
KUBE_TAR_RELATIVE_PATH="release"
|
|
||||||
KUBE_VERSION_FILE="stable.txt"
|
|
||||||
;;
|
|
||||||
"release")
|
|
||||||
# latest release candidate version is written in latest.txt in the /release dir
|
|
||||||
KUBE_TAR_RELATIVE_PATH="release"
|
|
||||||
KUBE_VERSION_FILE="latest.txt"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
KUBE_BINARY_DIRECTORY="${KUBE_RELEASE_BUCKET_URL}/${KUBE_TAR_RELATIVE_PATH}"
|
if [[ "${print_version}" == "true" ]]; then
|
||||||
KUBE_VERSION=$(curl --silent --fail "${KUBE_BINARY_DIRECTORY}/${KUBE_VERSION_FILE}")
|
echo "${KUBE_VERSION}"
|
||||||
KUBE_BINARY_PATH="${KUBE_BINARY_DIRECTORY}/${KUBE_VERSION}/${KUBE_TAR_NAME}"
|
else
|
||||||
|
echo "Using version at ${1}: ${KUBE_VERSION}" >&2
|
||||||
curl --fail -o kubernetes-${KUBE_VERSION}.tar.gz "${KUBE_BINARY_PATH}"
|
tars_from_version
|
||||||
|
curl --fail -o kubernetes-${KUBE_VERSION}.tar.gz "${KUBE_TAR_URL}"
|
||||||
|
fi
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -45,59 +44,14 @@ const (
|
||||||
versionURLFmt = "https://storage.googleapis.com/kubernetes-release/%s/%s.txt"
|
versionURLFmt = "https://storage.googleapis.com/kubernetes-release/%s/%s.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// realVersion turns a version constant s--one accepted by cluster/gce/upgrade.sh--
|
// realVersion turns a version constant s into a version string deployable on
|
||||||
// into a deployable version string. If the s is not known to be a version
|
// GKE. See hack/get-build.sh for more information.
|
||||||
// constant, it will assume it is already a valid version, and return s directly.
|
|
||||||
//
|
|
||||||
// NOTE: KEEP THIS LIST UP-TO-DATE WITH THE CODE BELOW.
|
|
||||||
// The version strings supported are:
|
|
||||||
// - "latest_stable" (returns a string like "0.18.2")
|
|
||||||
// - "latest_release" (returns a string like "0.19.1")
|
|
||||||
// - "latest_ci" (returns a string like "0.19.1-669-gabac8c8")
|
|
||||||
func realVersion(s string) (string, error) {
|
func realVersion(s string) (string, error) {
|
||||||
bucket, file := "", ""
|
v, _, err := runCmd(path.Join(testContext.RepoRoot, "hack/get-build.sh"), "-v", s)
|
||||||
switch s {
|
|
||||||
// NOTE: IF YOU CHANGE THE FOLLOWING LIST, ALSO UPDATE cluster/gce/upgrade.sh
|
|
||||||
case "latest_stable":
|
|
||||||
bucket, file = "release", "stable"
|
|
||||||
case "latest_release":
|
|
||||||
bucket, file = "release", "latest"
|
|
||||||
case "latest_ci":
|
|
||||||
bucket, file = "ci", "latest"
|
|
||||||
default:
|
|
||||||
// If we don't match one of the above, we assume that the passed version
|
|
||||||
// is already valid (such as "0.19.1" or "0.19.1-669-gabac8c8").
|
|
||||||
Logf("Assuming %q is already a valid version.", s)
|
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
url := fmt.Sprintf(versionURLFmt, bucket, file)
|
|
||||||
var v string
|
|
||||||
Logf("Fetching version from %s", url)
|
|
||||||
c := &http.Client{Timeout: 2 * time.Second}
|
|
||||||
if err := wait.Poll(poll, singleCallTimeout, func() (bool, error) {
|
|
||||||
r, err := c.Get(url)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logf("Error reaching %s: %v", url, err)
|
return v, err
|
||||||
return false, nil
|
|
||||||
}
|
}
|
||||||
if r.StatusCode != http.StatusOK {
|
return strings.TrimPrefix(strings.TrimSpace(v), "v"), nil
|
||||||
Logf("Bad response; status: %d, response: %v", r.StatusCode, r)
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
defer r.Body.Close()
|
|
||||||
b, err := ioutil.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
Logf("Could not read response body: %v", err)
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
v = strings.TrimSpace(string(b))
|
|
||||||
return true, nil
|
|
||||||
}); err != nil {
|
|
||||||
return "", fmt.Errorf("failed to fetch real version from %s", url)
|
|
||||||
}
|
|
||||||
// Versions start with "v", so remove that.
|
|
||||||
return strings.TrimPrefix(v, "v"), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following upgrade functions are passed into the framework below and used
|
// The following upgrade functions are passed into the framework below and used
|
||||||
|
@ -207,7 +161,7 @@ var _ = Describe("Skipped", func() {
|
||||||
var err error
|
var err error
|
||||||
v, err = realVersion(testContext.UpgradeTarget)
|
v, err = realVersion(testContext.UpgradeTarget)
|
||||||
expectNoError(err)
|
expectNoError(err)
|
||||||
Logf("Version for %q is %s", testContext.UpgradeTarget, v)
|
Logf("Version for %q is %q", testContext.UpgradeTarget, v)
|
||||||
|
|
||||||
By("Setting up the service, RC, and pods")
|
By("Setting up the service, RC, and pods")
|
||||||
f.beforeEach()
|
f.beforeEach()
|
||||||
|
|
|
@ -79,7 +79,7 @@ func init() {
|
||||||
|
|
||||||
flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources. Only required if provider is aws.")
|
flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources. Only required if provider is aws.")
|
||||||
flag.IntVar(&testContext.MinStartupPods, "minStartupPods", 0, "The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
|
flag.IntVar(&testContext.MinStartupPods, "minStartupPods", 0, "The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
|
||||||
flag.StringVar(&testContext.UpgradeTarget, "upgrade-target", "latest_ci", "Version to upgrade to (e.g. 'latest_stable', 'latest_release', 'latest_ci', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
|
flag.StringVar(&testContext.UpgradeTarget, "upgrade-target", "ci/latest", "Version to upgrade to (e.g. 'release/stable', 'release/latest', 'ci/latest', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
|
||||||
flag.StringVar(&testContext.PrometheusPushGateway, "prom-push-gateway", "", "The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
|
flag.StringVar(&testContext.PrometheusPushGateway, "prom-push-gateway", "", "The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
|
||||||
flag.BoolVar(&testContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
|
flag.BoolVar(&testContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue