From 6a2201f4105e0de65fa72cd235e8381e51678c28 Mon Sep 17 00:00:00 2001 From: Amey Deshpande Date: Wed, 31 Aug 2016 15:26:44 -0700 Subject: [PATCH] Pick a specific GCI version by default on GCE. Prior to this change, a K8s branch (master as well as release) was pinned to a GCI milestone. It would pick up the latest GCI release on that milestone at the time of cluster creation. The rationale was the K8s users would automatically get the bug fixes in newer versions of GCI. However in practice, it makes the runtime environment non-deterministic, and lack of continuous e2e tests mean we would run into breakages sooner or later. With this change, each K8s release will pick a specific version of GCI by default (similar to how the Debian-based container-vm gets used). Users can override the default version through KUBE_GCE_MASTER_IMAGE and KUBE_GCE_NODE_IMAGE environment variables. We expect the default GCI version will be updated relatively frequently stay updated with newer GCI releases. We can also automate the process to automatically bump the hard-coded GCI version in future. --- cluster/gce/config-default.sh | 1 + cluster/gce/config-test.sh | 1 + cluster/gce/util.sh | 23 ++--------------------- test/e2e_node/jenkins/image-config.yaml | 2 +- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index a16c6844f76..4ec0c0178fe 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -41,6 +41,7 @@ NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} # containervm. If you are updating the containervm version, update this # variable. CVM_VERSION=container-v1-3-v20160604 +GCI_VERSION="gci-dev-54-8743-3-0" MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-} MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers} NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${CVM_VERSION}} diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 7b6bf1b746a..19f21ee1676 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -42,6 +42,7 @@ NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} # containervm. If you are updating the containervm version, update this # variable. CVM_VERSION=container-v1-3-v20160604 +GCI_VERSION="gci-dev-54-8743-3-0" MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-} MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers} NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${CVM_VERSION}} diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 9e226ed4032..04642b65947 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -37,29 +37,10 @@ else exit 1 fi -function get_latest_gci_image() { - # GCI milestone to use - GCI_MILESTONE="53" - - # First try to find an active (non-deprecated) image on this milestone. - gci_images=( $(gcloud compute images list --project google-containers \ - --no-standard-images --sort-by="~creationTimestamp" \ - --regexp="gci-[a-z]+-${GCI_MILESTONE}-.*" --format="table[no-heading](name)") ) - - # If no active image is available, search across all deprecated images. - if [[ ${#gci_images[@]} == 0 ]] ; then - gci_images=( $(gcloud compute images list --project google-containers \ - --no-standard-images --show-deprecated --sort-by="~creationTimestamp" \ - --regexp="gci-[a-z]+-${GCI_MILESTONE}-.*" --format="table[no-heading](name)") ) - fi - - echo "${gci_images[0]}" -} - if [[ "${MASTER_OS_DISTRIBUTION}" == "gci" ]]; then # If the master image is not set, we use the latest GCI image. # Otherwise, we respect whatever is set by the user. - MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-"$(get_latest_gci_image)"} + MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-${GCI_VERSION}} MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers} elif [[ "${MASTER_OS_DISTRIBUTION}" == "debian" ]]; then MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-${CVM_VERSION}} @@ -69,7 +50,7 @@ fi if [[ "${NODE_OS_DISTRIBUTION}" == "gci" ]]; then # If the node image is not set, we use the latest GCI image. # Otherwise, we respect whatever is set by the user. - NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"$(get_latest_gci_image)"} + NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${GCI_VERSION}} NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-google-containers} elif [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${CVM_VERSION}} diff --git a/test/e2e_node/jenkins/image-config.yaml b/test/e2e_node/jenkins/image-config.yaml index f9840501d3f..e9e9f26f19b 100644 --- a/test/e2e_node/jenkins/image-config.yaml +++ b/test/e2e_node/jenkins/image-config.yaml @@ -16,6 +16,6 @@ images: image: e2e-node-containervm-v20160321-image project: kubernetes-node-e2e-images gci-family: - image_regex: gci-dev-.* + image_regex: gci-dev-54-8743-3-0 project: google-containers metadata: "user-data