gce.sh: Factor out default custom memory

This commit is contained in:
Trent Nelson 2021-01-05 21:26:49 -07:00 committed by Trent Nelson
parent 327be55acc
commit ddf1d2dbf5
5 changed files with 30 additions and 11 deletions

View File

@ -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

View File

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

View File

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

View File

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

View File

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