mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #49344 from shyamjvs/master-disk-size
Automatic merge from submit-queue Auto-calculate master disk and root disk sizes in GCE @gmarek PR https://github.com/kubernetes/kubernetes/pull/49282 didn't fix the issue because MASTER_DISK_SIZE was defaulting to 20GB in config-test.sh before being calculated inside get-master-disk-size() where you use pre-existing value if any. It should be fixed by this now.
This commit is contained in:
		@@ -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}"
 | 
			
		||||
 
 | 
			
		||||
@@ -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}
 | 
			
		||||
 
 | 
			
		||||
@@ -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}
 | 
			
		||||
 
 | 
			
		||||
@@ -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}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -949,35 +949,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:
 | 
			
		||||
@@ -1022,7 +993,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}" \
 | 
			
		||||
@@ -1074,9 +1044,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}" &
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1135,16 +1102,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}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user