change shell var MINION_SCOPES to user setable
Because bash arrays may not be environment variables (see: <https://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script>) we have to change the MINION_SCOPES array to a string * prefers aliases instead of full URLs for scopes tested under GKE, needs GCE testing Close #10458
This commit is contained in:
parent
bfd7477b5b
commit
db1a73317c
@ -41,7 +41,8 @@ MASTER_TAG="${INSTANCE_PREFIX}-master"
|
|||||||
MINION_TAG="${INSTANCE_PREFIX}-minion"
|
MINION_TAG="${INSTANCE_PREFIX}-minion"
|
||||||
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
|
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
|
||||||
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.244.0.0/16}"
|
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.
|
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
|
||||||
POLL_SLEEP_INTERVAL=3
|
POLL_SLEEP_INTERVAL=3
|
||||||
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
|
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
|
||||||
|
@ -42,7 +42,7 @@ MASTER_TAG="${INSTANCE_PREFIX}-master"
|
|||||||
MINION_TAG="${INSTANCE_PREFIX}-minion"
|
MINION_TAG="${INSTANCE_PREFIX}-minion"
|
||||||
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}"
|
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}"
|
||||||
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
|
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.
|
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
|
||||||
POLL_SLEEP_INTERVAL=3
|
POLL_SLEEP_INTERVAL=3
|
||||||
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
|
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
|
||||||
|
2
cluster/gce/coreos/helper.sh
Normal file → Executable file
2
cluster/gce/coreos/helper.sh
Normal file → Executable file
@ -140,7 +140,7 @@ function create-node-instance-template {
|
|||||||
if [[ -n ${1:-} ]]; then
|
if [[ -n ${1:-} ]]; then
|
||||||
suffix="-${1}"
|
suffix="-${1}"
|
||||||
fi
|
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" \
|
"kube-env=${KUBE_TEMP}/node-kube-env.yaml" \
|
||||||
"user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml"
|
"user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml"
|
||||||
}
|
}
|
||||||
|
2
cluster/gce/debian/helper.sh
Normal file → Executable file
2
cluster/gce/debian/helper.sh
Normal file → Executable file
@ -120,7 +120,7 @@ function create-node-instance-template {
|
|||||||
if [[ -n ${1:-} ]]; then
|
if [[ -n ${1:-} ]]; then
|
||||||
suffix="-${1}"
|
suffix="-${1}"
|
||||||
fi
|
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" \
|
"startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh" \
|
||||||
"kube-env=${KUBE_TEMP}/node-kube-env.yaml"
|
"kube-env=${KUBE_TEMP}/node-kube-env.yaml"
|
||||||
}
|
}
|
||||||
|
@ -178,11 +178,11 @@ function prepare-node-upgrade() {
|
|||||||
detect-minion-names
|
detect-minion-names
|
||||||
|
|
||||||
# TODO(mbforbes): Refactor setting scope flags.
|
# TODO(mbforbes): Refactor setting scope flags.
|
||||||
local -a scope_flags=()
|
local scope_flags=
|
||||||
if (( "${#MINION_SCOPES[@]}" > 0 )); then
|
if [ -n "${MINION_SCOPES}" ]; then
|
||||||
scope_flags=("--scopes" "$(join_csv ${MINION_SCOPES[@]})")
|
scope_flags="--scopes ${MINION_SCOPES}"
|
||||||
else
|
else
|
||||||
scope_flags=("--no-scopes")
|
scope_flags="--no-scopes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get required node env vars from exiting template.
|
# Get required node env vars from exiting template.
|
||||||
|
@ -685,11 +685,11 @@ function kube-up {
|
|||||||
echo "Creating minions."
|
echo "Creating minions."
|
||||||
|
|
||||||
# TODO(mbforbes): Refactor setting scope flags.
|
# TODO(mbforbes): Refactor setting scope flags.
|
||||||
local -a scope_flags=()
|
local scope_flags=
|
||||||
if (( "${#MINION_SCOPES[@]}" > 0 )); then
|
if [ -n "${MINION_SCOPES}" ]; then
|
||||||
scope_flags=("--scopes" "$(join_csv ${MINION_SCOPES[@]})")
|
scope_flags="--scopes ${MINION_SCOPES}"
|
||||||
else
|
else
|
||||||
scope_flags=("--no-scopes")
|
scope_flags="--no-scopes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
write-node-env
|
write-node-env
|
||||||
@ -1007,11 +1007,11 @@ function prepare-push() {
|
|||||||
write-node-env
|
write-node-env
|
||||||
|
|
||||||
# TODO(mbforbes): Refactor setting scope flags.
|
# TODO(mbforbes): Refactor setting scope flags.
|
||||||
local -a scope_flags=()
|
local scope_flags=
|
||||||
if (( "${#MINION_SCOPES[@]}" > 0 )); then
|
if [ -n "${MINION_SCOPES}" ]; then
|
||||||
scope_flags=("--scopes" "${MINION_SCOPES[@]}")
|
scope_flags="--scopes ${MINION_SCOPES}"
|
||||||
else
|
else
|
||||||
scope_flags=("--no-scopes")
|
scope_flags="--no-scopes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ugly hack: Since it is not possible to delete instance-template that is currently
|
# Ugly hack: Since it is not possible to delete instance-template that is currently
|
||||||
|
@ -30,6 +30,7 @@ GCLOUD="${GCLOUD:-gcloud}"
|
|||||||
CMD_GROUP="${CMD_GROUP:-alpha}"
|
CMD_GROUP="${CMD_GROUP:-alpha}"
|
||||||
GCLOUD_CONFIG_DIR="${GCLOUD_CONFIG_DIR:-${HOME}/.config/gcloud/kubernetes}"
|
GCLOUD_CONFIG_DIR="${GCLOUD_CONFIG_DIR:-${HOME}/.config/gcloud/kubernetes}"
|
||||||
ENABLE_CLUSTER_DNS=false
|
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
|
# 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
|
# then things grossly fail during normal runs because cluster/kubecfg.sh and
|
||||||
|
@ -112,6 +112,7 @@ function verify-prereqs() {
|
|||||||
# ZONE
|
# ZONE
|
||||||
# CLUSTER_API_VERSION (optional)
|
# CLUSTER_API_VERSION (optional)
|
||||||
# NUM_MINIONS
|
# NUM_MINIONS
|
||||||
|
# MINION_SCOPES
|
||||||
function kube-up() {
|
function kube-up() {
|
||||||
echo "... in kube-up()" >&2
|
echo "... in kube-up()" >&2
|
||||||
detect-project >&2
|
detect-project >&2
|
||||||
@ -142,6 +143,7 @@ function kube-up() {
|
|||||||
"--project=${PROJECT}"
|
"--project=${PROJECT}"
|
||||||
"--num-nodes=${NUM_MINIONS}"
|
"--num-nodes=${NUM_MINIONS}"
|
||||||
"--network=${NETWORK}"
|
"--network=${NETWORK}"
|
||||||
|
"--scopes=${MINION_SCOPES}"
|
||||||
)
|
)
|
||||||
if [[ ! -z "${DOGFOOD_GCLOUD:-}" ]]; then
|
if [[ ! -z "${DOGFOOD_GCLOUD:-}" ]]; then
|
||||||
create_args+=("--cluster-version=${CLUSTER_API_VERSION:-}")
|
create_args+=("--cluster-version=${CLUSTER_API_VERSION:-}")
|
||||||
|
Loading…
Reference in New Issue
Block a user