소스 검색

gce.sh: Factor out default custom memory

Trent Nelson 4 년 전
부모
커밋
ddf1d2dbf5
5개의 변경된 파일30개의 추가작업 그리고 11개의 파일을 삭제
  1. 14 11
      net/gce.sh
  2. 4 0
      net/scripts/azure-provider.sh
  3. 4 0
      net/scripts/colo-provider.sh
  4. 4 0
      net/scripts/ec2-provider.sh
  5. 4 0
      net/scripts/gce-provider.sh

+ 14 - 11
net/gce.sh

@@ -12,7 +12,7 @@ gce)
   # shellcheck source=net/scripts/gce-provider.sh
   source "$here"/scripts/gce-provider.sh
 
-  cpuBootstrapLeaderMachineType="--custom-cpu 24 --custom-memory 64GB --min-cpu-platform Intel%20Skylake"
+  cpuBootstrapLeaderMachineType="--custom-cpu 24 --min-cpu-platform Intel%20Skylake"
   gpuBootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType --accelerator count=1,type=nvidia-tesla-p100"
   clientMachineType="--custom-cpu 16 --custom-memory 20GB"
   blockstreamerMachineType="--machine-type n1-standard-8"
@@ -283,16 +283,6 @@ while getopts "h?p:Pn:c:r:z:gG:a:d:uxf" opt "${shortArgs[@]}"; do
   esac
 done
 
-if [[ -n "$customMachineType" ]] ; then
-  bootstrapLeaderMachineType="$customMachineType"
-elif [[ "$enableGpu" = "true" ]] ; then
-  bootstrapLeaderMachineType="$gpuBootstrapLeaderMachineType"
-else
-  bootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType"
-fi
-validatorMachineType=$bootstrapLeaderMachineType
-blockstreamerMachineType=$bootstrapLeaderMachineType
-
 [[ ${#zones[@]} -gt 0 ]] || zones+=("$(cloud_DefaultZone)")
 
 [[ -z $1 ]] || usage "Unexpected argument: $1"
@@ -307,6 +297,9 @@ fi
 
 case $cloudProvider in
 gce)
+  customMemoryGB="$(cloud_DefaultCustomMemoryGB)"
+  cpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
+  gpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
   ;;
 ec2|azure|colo)
   if [[ -n $validatorAdditionalDiskSizeInGb ]] ; then
@@ -338,6 +331,16 @@ if [[ -n $reclaimAllReservations || -n $reclaimOnlyPreemptibleReservations ]]; t
   forceDelete="true"
 fi
 
+if [[ -n "$customMachineType" ]] ; then
+  bootstrapLeaderMachineType="$customMachineType"
+elif [[ "$enableGpu" = "true" ]] ; then
+  bootstrapLeaderMachineType="$gpuBootstrapLeaderMachineType"
+else
+  bootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType"
+fi
+validatorMachineType=$bootstrapLeaderMachineType
+blockstreamerMachineType=$bootstrapLeaderMachineType
+
 # cloud_ForEachInstance [cmd] [extra args to cmd]
 #
 # Execute a command for each element in the `instances` array

+ 4 - 0
net/scripts/azure-provider.sh

@@ -8,6 +8,10 @@ cloud_DefaultZone() {
   echo "westus"
 }
 
+cloud_DefaultCustomMemoryGB() {
+  : # Not implemented
+}
+
 cloud_RestartPreemptedInstances() {
   : # Not implemented
 }

+ 4 - 0
net/scripts/colo-provider.sh

@@ -17,6 +17,10 @@ cloud_DefaultZone() {
   echo "Denver"
 }
 
+cloud_DefaultCustomMemoryGB() {
+  : # Not implemented
+}
+
 cloud_RestartPreemptedInstances() {
   : # Not implemented
 }

+ 4 - 0
net/scripts/ec2-provider.sh

@@ -7,6 +7,10 @@ cloud_DefaultZone() {
   echo "us-east-1b"
 }
 
+cloud_DefaultCustomMemoryGB() {
+  : # Not implemented
+}
+
 cloud_RestartPreemptedInstances() {
   : # Not implemented
 }

+ 4 - 0
net/scripts/gce-provider.sh

@@ -8,6 +8,10 @@ cloud_DefaultZone() {
   echo "us-west1-b"
 }
 
+cloud_DefaultCustomMemoryGB() {
+  echo 64
+}
+
 #
 # cloud_RestartPreemptedInstances [namePrefix]
 #