diff --git a/cluster/gce/config-common.sh b/cluster/gce/config-common.sh index 2c9f0329e9f..dee1aad2c4d 100644 --- a/cluster/gce/config-common.sh +++ b/cluster/gce/config-common.sh @@ -39,6 +39,32 @@ function get-master-size { echo "${suggested_master_size}" } +# Vars assumed: +# NUM_NODES +function get-master-root-disk-size() { + local suggested_master_root_disk_size="20GB" + if [[ "${NUM_NODES}" -gt "1000" ]]; then + suggested_master_root_disk_size="50GB" + fi + if [[ "${NUM_NODES}" -gt "2000" ]]; then + suggested_master_root_disk_size="100GB" + fi + echo "${suggested_master_root_disk_size}" +} + +# Vars assumed: +# NUM_NODES +function get-master-disk-size() { + local suggested_master_disk_size="20GB" + if [[ "${NUM_NODES}" -gt "1000" ]]; then + suggested_master_disk_size="100GB" + fi + if [[ "${NUM_NODES}" -gt "2000" ]]; then + suggested_master_disk_size="200GB" + fi + echo "${suggested_master_disk_size}" +} + function get-node-ip-range { if [[ -n "${NODE_IP_RANGE:-}" ]]; then >&2 echo "Using user provided NODE_IP_RANGE: ${NODE_IP_RANGE}" diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index d2b6837ce45..8e052d3cd6e 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -31,7 +31,8 @@ NODE_SIZE=${NODE_SIZE:-n1-standard-2} NUM_NODES=${NUM_NODES:-3} MASTER_SIZE=${MASTER_SIZE:-n1-standard-$(get-master-size)} MASTER_DISK_TYPE=pd-ssd -MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB} +MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-$(get-master-disk-size)} +MASTER_ROOT_DISK_SIZE=${MASTER_ROOT_DISK_SIZE:-$(get-master-root-disk-size)} NODE_DISK_TYPE=${NODE_DISK_TYPE:-pd-standard} NODE_DISK_SIZE=${NODE_DISK_SIZE:-100GB} NODE_LOCAL_SSDS=${NODE_LOCAL_SSDS:-0} diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 216d766009e..98067213f5e 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -31,7 +31,8 @@ NODE_SIZE=${NODE_SIZE:-n1-standard-2} NUM_NODES=${NUM_NODES:-3} MASTER_SIZE=${MASTER_SIZE:-n1-standard-$(get-master-size)} MASTER_DISK_TYPE=pd-ssd -MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB} +MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-$(get-master-disk-size)} +MASTER_ROOT_DISK_SIZE=${MASTER_ROOT_DISK_SIZE:-$(get-master-root-disk-size)} NODE_DISK_TYPE=${NODE_DISK_TYPE:-pd-standard} NODE_DISK_SIZE=${NODE_DISK_SIZE:-100GB} NODE_LOCAL_SSDS=${NODE_LOCAL_SSDS:-0} diff --git a/cluster/gce/gci/master-helper.sh b/cluster/gce/gci/master-helper.sh index ed7bf31c97a..f27a7b24720 100755 --- a/cluster/gce/gci/master-helper.sh +++ b/cluster/gce/gci/master-helper.sh @@ -116,7 +116,7 @@ function create-master-instance-internal() { --scopes "storage-ro,compute-rw,monitoring,logging-write" \ --metadata-from-file "${metadata}" \ --disk "${disk}" \ - --boot-disk-size "${MASTER_ROOT_DISK_SIZE:-10}" \ + --boot-disk-size "${MASTER_ROOT_DISK_SIZE}" \ ${preemptible_master} \ ${network} } diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 8354141cbc7..65ba3117bf3 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -945,35 +945,6 @@ function delete-subnetworks() { fi } -# Assumes: -# NUM_NODES -# Sets: -# MASTER_ROOT_DISK_SIZE -function get-master-root-disk-size() { - if [[ "${NUM_NODES}" -le "1000" ]]; then - export MASTER_ROOT_DISK_SIZE="${MASTER_ROOT_DISK_SIZE:-20}" - elif [[ "${NUM_NODES}" -le "2000" ]]; then - export MASTER_ROOT_DISK_SIZE="${MASTER_ROOT_DISK_SIZE:-50}" - else - export MASTER_ROOT_DISK_SIZE="${MASTER_ROOT_DISK_SIZE:-100}" - fi -} - -# Assumes: -# NUM_NODES -# Sets: -# MASTER_DISK_SIZE -function get-master-disk-size() { - if [[ "${NUM_NODES}" -le "1000" ]]; then - export MASTER_DISK_SIZE="${MASTER_DISK_SIZE:-20GB}" - elif [[ "${NUM_NODES}" -le "2000" ]]; then - export MASTER_DISK_SIZE="${MASTER_DISK_SIZE:-100GB}" - else - export MASTER_DISK_SIZE="${MASTER_DISK_SIZE:-200GB}" - fi -} - - # Generates SSL certificates for etcd cluster. Uses cfssl program. # # Assumed vars: @@ -1018,7 +989,6 @@ function create-master() { # We have to make sure the disk is created before creating the master VM, so # run this in the foreground. - get-master-disk-size gcloud compute disks create "${MASTER_NAME}-pd" \ --project "${PROJECT}" \ --zone "${ZONE}" \ @@ -1070,9 +1040,6 @@ function create-master() { create-certs "${MASTER_RESERVED_IP}" create-etcd-certs ${MASTER_NAME} - # Sets MASTER_ROOT_DISK_SIZE that is used by create-master-instance - get-master-root-disk-size - create-master-instance "${MASTER_RESERVED_IP}" & } @@ -1131,16 +1098,12 @@ function replicate-master() { # We have to make sure the disk is created before creating the master VM, so # run this in the foreground. - get-master-disk-size gcloud compute disks create "${REPLICA_NAME}-pd" \ --project "${PROJECT}" \ --zone "${ZONE}" \ --type "${MASTER_DISK_TYPE}" \ --size "${MASTER_DISK_SIZE}" - # Sets MASTER_ROOT_DISK_SIZE that is used by create-master-instance - get-master-root-disk-size - local existing_master_replicas="$(get-all-replica-names)" replicate-master-instance "${EXISTING_MASTER_ZONE}" "${EXISTING_MASTER_NAME}" "${existing_master_replicas}"