Skip to content

Commit

Permalink
Replace containervm with GCI as default master image for GCE clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderfly committed May 24, 2016
1 parent 50524c7 commit 3d95151
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function find-release-tars() {

# This tarball is used by GCI, Ubuntu Trusty, and CoreOS.
KUBE_MANIFESTS_TAR=
if [[ "${KUBE_OS_DISTRIBUTION:-}" == "trusty" || "${KUBE_OS_DISTRIBUTION:-}" == "gci" || "${KUBE_OS_DISTRIBUTION:-}" == "coreos" ]]; then
if [[ "${OS_DISTRIBUTION:-}" == "trusty" || "${OS_DISTRIBUTION:-}" == "gci" || "${OS_DISTRIBUTION:-}" == "coreos" ]]; then
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/server/kubernetes-manifests.tar.gz"
if [[ ! -f "${KUBE_MANIFESTS_TAR}" ]]; then
KUBE_MANIFESTS_TAR="${KUBE_ROOT}/_output/release-tars/kubernetes-manifests.tar.gz"
Expand Down
17 changes: 13 additions & 4 deletions cluster/gce/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@ PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}


OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian}
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20160321}
# Today the cluster startup scripts asssume the master and the nodes use the
# same OS distro, thus same set of initialization instructions (e.g., metadata,
# startup scripts, etc.). The current workaround is the hack in util.sh that
# reloads <os_distro>/helper.sh in the gap between when the master is created
# and when the nodes are created.
# TODO(#26183): Provide a way to differentiate master OS distro and node OS
# distro.
OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-gci}
# For GCI, leaving it blank will auto-select the latest GCI image on the `dev`
# channel.
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers}
NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"${MASTER_IMAGE}"}
NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-"${MASTER_IMAGE_PROJECT}"}
NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-container-vm-v20160321}
NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-google-containers}
CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5}

Expand Down
10 changes: 6 additions & 4 deletions cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ KUBE_APISERVER_REQUEST_TIMEOUT=300
PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}

OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian}
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20160321}
OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-gci}
# For GCI, leaving it blank will auto-select the latest GCI image on the `dev`
# channel.
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers}
NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"${MASTER_IMAGE}"}
NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-"${MASTER_IMAGE_PROJECT}"}
NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-container-vm-v20160321}
NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-google-containers}
CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5}

Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ if [[ "${OS_DISTRIBUTION}" == "gci" ]]; then
# Otherwise, we respect whatever set by the user.
gci_images=( $(gcloud compute images list --project google-containers \
--regexp='gci-dev.*' --format='value(name)') )
if [[ -z "${KUBE_GCE_MASTER_IMAGE:-}" ]]; then
if [[ -z "${MASTER_IMAGE:-}" ]]; then

This comment has been minimized.

Copy link
@andyzheng0831

andyzheng0831 Jun 1, 2016

I don't understand why the if condition should be changed. The default value of KUBE_GCE_MASTER_IMAGE is changed to be empty. It is unnecessary to change this if condition.

This comment has been minimized.

Copy link
@wonderfly

wonderfly Jun 1, 2016

Author Contributor

The KUBE_ version of env vars are supposed to be set by end users only - it was inappropriate to use them in such a later stage here in this script.

MASTER_IMAGE="${gci_images[0]}"
MASTER_IMAGE_PROJECT="google-containers"
fi
if [[ -z "${KUBE_GCE_NODE_IMAGE:-}" ]]; then
if [[ -z "${NODE_IMAGE:-}" ]]; then

This comment has been minimized.

Copy link
@andyzheng0831

andyzheng0831 Jun 1, 2016

This change is wrong, and the entire if block will not be executed. NODE_IMAGE will never be unset. If KUBE_GCE_NODE_IMAGE is unset, NODE_IMAGE will be a ContainerVM image. If KUBE_GCE_NODE_IMAGE is set, NODE_IMAGE is set to KUBE_GCE_NODE_IMAGE.

This comment has been minimized.

Copy link
@wonderfly

wonderfly Jun 1, 2016

Author Contributor

Please see #26316 for an update of this setting.

NODE_IMAGE="${gci_images[0]}"
NODE_IMAGE_PROJECT="google-containers"
fi
Expand Down
2 changes: 1 addition & 1 deletion hack/ginkgo-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export PATH=$(dirname "${e2e_test}"):"${PATH}"
--repo-root="${KUBE_ROOT}" \
--node-instance-group="${NODE_INSTANCE_GROUP:-}" \
--prefix="${KUBE_GCE_INSTANCE_PREFIX:-e2e}" \
${KUBE_OS_DISTRIBUTION:+"--os-distro=${KUBE_OS_DISTRIBUTION}"} \
${OS_DISTRIBUTION:+"--os-distro=${OS_DISTRIBUTION}"} \
${NUM_NODES:+"--num-nodes=${NUM_NODES}"} \
${E2E_CLEAN_START:+"--clean-start=true"} \
${E2E_MIN_STARTUP_PODS:+"--minStartupPods=${E2E_MIN_STARTUP_PODS}"} \
Expand Down
1 change: 1 addition & 0 deletions hack/verify-flags/exceptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cluster/aws/templates/configure-vm-aws.sh: env-to-grains "hostname_override"
cluster/aws/templates/configure-vm-aws.sh: env-to-grains "runtime_config"
cluster/aws/templates/configure-vm-aws.sh: kubelet_api_servers: '${KUBELET_APISERVER}'
cluster/centos/util.sh: local node_ip=${node#*@}
cluster/gce/config-default.sh:# reloads <os_distro>/helper.sh in the gap between when the master is created
cluster/gce/configure-vm.sh: advertise_address: '${EXTERNAL_IP}'
cluster/gce/configure-vm.sh: api_servers: '${KUBERNETES_MASTER_NAME}'
cluster/gce/configure-vm.sh: cloud_config: ${CLOUD_CONFIG}
Expand Down

0 comments on commit 3d95151

Please sign in to comment.