Merge pull request #26813 from wonderfly/choose_docker_version

Automatic merge from submit-queue

Prep for continuous Docker validation test

```release-note
Add a test config variable to specify desired Docker version to run on GCI.
```
We want to continuously validate Docker releases (#25215), on GCI. This change
adds a new test config variable, `KUBE_GCI_DOCKER_VERSION`, through which we can
specify which version of Docker we want to run on the master and nodes. This
change also patches the Jenkins e2e-runner with the ability to fetch the latest
Docker (pre)release, and sets the aforementioned variable accordingly.

Tested on my local Jenkins instance that was able to start a cluster with the latest Docker version (different from installed version) running on both master and nodes.

@dchen1107 Can you review?

cc/ @andyzheng0831 for changes in `cluster/gce/gci/helper.sh`, and @ixdy @spxtr for changes to the Jenkins e2e-runner

cc/ @kubernetes/goog-image
This commit is contained in:
k8s-merge-robot 2016-06-18 11:00:55 -07:00 committed by GitHub
commit 48b255d424
3 changed files with 35 additions and 9 deletions

View File

@ -48,6 +48,7 @@ NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"${MASTER_IMAGE}"}
NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-"${MASTER_IMAGE_PROJECT}"}
CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5}
GCI_DOCKER_VERSION=${KUBE_GCI_DOCKER_VERSION:-}
NETWORK=${KUBE_GCE_NETWORK:-e2e}
INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}"

View File

@ -25,9 +25,14 @@ function ensure-gci-metadata-files {
update_disabled
EOF
fi
if [[ ! -f "${KUBE_TEMP}/gci-docker.txt" ]]; then
cat >"${KUBE_TEMP}/gci-docker.txt" << EOF
if [[ ! -f "${KUBE_TEMP}/gci-ensure-gke-docker.txt" ]]; then
cat >"${KUBE_TEMP}/gci-ensure-gke-docker.txt" << EOF
true
EOF
fi
if [[ ! -f "${KUBE_TEMP}/gci-docker-version.txt" ]]; then
cat >"${KUBE_TEMP}/gci-docker-version.txt" << EOF
${GCI_DOCKER_VERSION}
EOF
fi
}
@ -42,7 +47,8 @@ function create-node-instance-template {
"configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh" \
"cluster-name=${KUBE_TEMP}/cluster-name.txt" \
"gci-update-strategy=${KUBE_TEMP}/gci-update.txt" \
"gci-ensure-gke-docker=${KUBE_TEMP}/gci-docker.txt"
"gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt" \
"gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt"
}
# create-master-instance creates the master instance. If called with
@ -76,7 +82,7 @@ function create-master-instance {
--scopes "storage-ro,compute-rw,monitoring,logging-write" \
--can-ip-forward \
--metadata-from-file \
"kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt,gci-update-strategy=${KUBE_TEMP}/gci-update.txt,gci-ensure-gke-docker=${KUBE_TEMP}/gci-docker.txt" \
"kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt,gci-update-strategy=${KUBE_TEMP}/gci-update.txt,gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt,gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt" \
--disk "name=${MASTER_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" \
--boot-disk-size "${MASTER_ROOT_DISK_SIZE:-10}"
}

View File

@ -103,20 +103,24 @@ function get_latest_gci_image() {
local image_type="$2"
local image_index=""
if [[ "${image_type}" == head ]]; then
image_index="gci-head"
image_index="latest-base-image-gci-head"
elif [[ "${image_type}" == dev ]]; then
image_index="gci-dev"
image_index="latest-base-image-gci-dev"
elif [[ "${image_type}" == beta ]]; then
image_index="gci-beta"
image_index="latest-base-image-gci-beta"
elif [[ "${image_type}" == stable ]]; then
image_index="gci-stable"
image_index="latest-base-image-gci-stable"
elif [[ "${image_type}" == preview-test ]]; then
# A GCI preview image that is able to override its Docker installation on
# boot.
image_index="latest-test-image-gci-preview"
fi
local image=""
# Retry the gsutil command a couple times to mitigate the effect of
# transient server errors.
for n in $(seq 3); do
image="$(gsutil cat "gs://${image_project}/image-indices/latest-base-image-${image_index}")" && break || sleep 1
image="$(gsutil cat "gs://${image_project}/image-indices/${image_index}")" && break || sleep 1
done
if [[ -z "${image}" ]]; then
echo "Failed to find GCI image for ${image_type}"
@ -128,6 +132,18 @@ function get_latest_gci_image() {
rm -rf .gsutil &> /dev/null
}
function get_latest_docker_release() {
# Typical Docker release versions are like v1.11.2-rc1, v1.11.2, and etc.
local -r version_re='.*\"tag_name\":[[:space:]]+\"v([0-9\.r|c-]+)\",.*'
local -r latest_release="$(curl -fsSL --retry 3 https://api.github.com/repos/docker/docker/releases/latest)"
if [[ "${latest_release}" =~ ${version_re} ]]; then
echo "${BASH_REMATCH[1]}"
else
echo "Malformed Docker API response for latest release: ${latest_release}"
exit 1
fi
}
function install_google_cloud_sdk_tarball() {
local -r tarball=$1
local -r install_dir=$2
@ -196,6 +212,9 @@ if [[ -n "${JENKINS_GCI_IMAGE_TYPE:-}" ]]; then
export KUBE_GCE_MASTER_PROJECT="${gci_image_project}"
export KUBE_GCE_MASTER_IMAGE="${gci_image}"
export KUBE_OS_DISTRIBUTION="gci"
if [[ "${JENKINS_GCI_IMAGE_TYPE}" == preview-test ]]; then
export KUBE_GCI_DOCKER_VERSION="$(get_latest_docker_release)"
fi
fi
function e2e_test() {