diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index c6f31c93a5b..d0c3fa4da49 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -41,7 +41,8 @@ MASTER_TAG="${INSTANCE_PREFIX}-master" MINION_TAG="${INSTANCE_PREFIX}-minion" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.244.0.0/16}" -MINION_SCOPES=("storage-ro" "compute-rw" "https://www.googleapis.com/auth/monitoring" "https://www.googleapis.com/auth/logging.write") +MINION_SCOPES="${MINION_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}" + # Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default. POLL_SLEEP_INTERVAL=3 SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index fae9b7fa63c..0dd880f2d81 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -42,7 +42,7 @@ MASTER_TAG="${INSTANCE_PREFIX}-master" MINION_TAG="${INSTANCE_PREFIX}-minion" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" -MINION_SCOPES=("storage-ro" "compute-rw" "https://www.googleapis.com/auth/logging.write" "https://www.googleapis.com/auth/monitoring") +MINION_SCOPES="${MINION_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}" # Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default. POLL_SLEEP_INTERVAL=3 SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET diff --git a/cluster/gce/coreos/helper.sh b/cluster/gce/coreos/helper.sh old mode 100644 new mode 100755 index bddf826926a..76e83d21157 --- a/cluster/gce/coreos/helper.sh +++ b/cluster/gce/coreos/helper.sh @@ -140,7 +140,7 @@ function create-node-instance-template { if [[ -n ${1:-} ]]; then suffix="-${1}" fi - create-node-template "${NODE_INSTANCE_PREFIX}-template${suffix}" "${scope_flags[*]}" \ + create-node-template "${NODE_INSTANCE_PREFIX}-template${suffix}" "${scope_flags}" \ "kube-env=${KUBE_TEMP}/node-kube-env.yaml" \ "user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml" } diff --git a/cluster/gce/debian/helper.sh b/cluster/gce/debian/helper.sh old mode 100644 new mode 100755 index eaa056ba370..4425721a1a4 --- a/cluster/gce/debian/helper.sh +++ b/cluster/gce/debian/helper.sh @@ -120,7 +120,7 @@ function create-node-instance-template { if [[ -n ${1:-} ]]; then suffix="-${1}" fi - create-node-template "${NODE_INSTANCE_PREFIX}-template${suffix}" "${scope_flags[*]}" \ + create-node-template "${NODE_INSTANCE_PREFIX}-template${suffix}" "${scope_flags}" \ "startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh" \ "kube-env=${KUBE_TEMP}/node-kube-env.yaml" } diff --git a/cluster/gce/upgrade.sh b/cluster/gce/upgrade.sh index 3444a6c3e66..fc5ebbcbbfd 100755 --- a/cluster/gce/upgrade.sh +++ b/cluster/gce/upgrade.sh @@ -178,11 +178,11 @@ function prepare-node-upgrade() { detect-minion-names # TODO(mbforbes): Refactor setting scope flags. - local -a scope_flags=() - if (( "${#MINION_SCOPES[@]}" > 0 )); then - scope_flags=("--scopes" "$(join_csv ${MINION_SCOPES[@]})") + local scope_flags= + if [ -n "${MINION_SCOPES}" ]; then + scope_flags="--scopes ${MINION_SCOPES}" else - scope_flags=("--no-scopes") + scope_flags="--no-scopes" fi # Get required node env vars from exiting template. diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 371f9b63f38..94cb47603b4 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -685,11 +685,11 @@ function kube-up { echo "Creating minions." # TODO(mbforbes): Refactor setting scope flags. - local -a scope_flags=() - if (( "${#MINION_SCOPES[@]}" > 0 )); then - scope_flags=("--scopes" "$(join_csv ${MINION_SCOPES[@]})") + local scope_flags= + if [ -n "${MINION_SCOPES}" ]; then + scope_flags="--scopes ${MINION_SCOPES}" else - scope_flags=("--no-scopes") + scope_flags="--no-scopes" fi write-node-env @@ -1007,11 +1007,11 @@ function prepare-push() { write-node-env # TODO(mbforbes): Refactor setting scope flags. - local -a scope_flags=() - if (( "${#MINION_SCOPES[@]}" > 0 )); then - scope_flags=("--scopes" "${MINION_SCOPES[@]}") + local scope_flags= + if [ -n "${MINION_SCOPES}" ]; then + scope_flags="--scopes ${MINION_SCOPES}" else - scope_flags=("--no-scopes") + scope_flags="--no-scopes" fi # Ugly hack: Since it is not possible to delete instance-template that is currently diff --git a/cluster/gke/config-common.sh b/cluster/gke/config-common.sh index 9c4a96dd407..63625ab799c 100644 --- a/cluster/gke/config-common.sh +++ b/cluster/gke/config-common.sh @@ -30,6 +30,7 @@ GCLOUD="${GCLOUD:-gcloud}" CMD_GROUP="${CMD_GROUP:-alpha}" GCLOUD_CONFIG_DIR="${GCLOUD_CONFIG_DIR:-${HOME}/.config/gcloud/kubernetes}" ENABLE_CLUSTER_DNS=false +MINION_SCOPES="${MINION_SCOPES:-"compute-rw,storage-ro"}" # This is a hack, but I keep setting this when I run commands manually, and # then things grossly fail during normal runs because cluster/kubecfg.sh and diff --git a/cluster/gke/util.sh b/cluster/gke/util.sh index 6d4ea3a477d..33ecd02606a 100755 --- a/cluster/gke/util.sh +++ b/cluster/gke/util.sh @@ -112,6 +112,7 @@ function verify-prereqs() { # ZONE # CLUSTER_API_VERSION (optional) # NUM_MINIONS +# MINION_SCOPES function kube-up() { echo "... in kube-up()" >&2 detect-project >&2 @@ -142,6 +143,7 @@ function kube-up() { "--project=${PROJECT}" "--num-nodes=${NUM_MINIONS}" "--network=${NETWORK}" + "--scopes=${MINION_SCOPES}" ) if [[ ! -z "${DOGFOOD_GCLOUD:-}" ]]; then create_args+=("--cluster-version=${CLUSTER_API_VERSION:-}")