net/gce.sh: Add cusom RAM arg instead of doubling default with tmpfs

This commit is contained in:
Trent Nelson
2021-01-15 13:41:31 -07:00
committed by Trent Nelson
parent ff599ace4d
commit 3175cf1deb

View File

@ -69,6 +69,8 @@ failOnValidatorBootupFailure=true
preemptible=true preemptible=true
evalInfo=false evalInfo=false
tmpfsAccounts=false tmpfsAccounts=false
defaultCustomMemoryGB="$(cloud_DefaultCustomMemoryGB)"
customMemoryGB="$defaultCustomMemoryGB"
publicNetwork=false publicNetwork=false
letsEncryptDomainName= letsEncryptDomainName=
@ -138,6 +140,12 @@ Manage testnet instances
--custom-machine-type [type] --custom-machine-type [type]
- Set a custom machine type without assuming whether or not - Set a custom machine type without assuming whether or not
GPU is enabled. Set this explicitly with --enable-gpu/-g to call out the presence of GPUs. GPU is enabled. Set this explicitly with --enable-gpu/-g to call out the presence of GPUs.
$(
if [[ -n "$defaultCustomMemoryGB" ]]; then
echo " --custom-memory-gb"
echo " - Set memory size for custom machine type in GB (default: $defaultCustomMemoryGB)"
fi
)
--enable-gpu - Use with --custom-machine-type to specify whether or not GPUs should be used/enabled --enable-gpu - Use with --custom-machine-type to specify whether or not GPUs should be used/enabled
--validator-additional-disk-size-gb [number] --validator-additional-disk-size-gb [number]
- Add an additional [number] GB SSD to all validators to store the config directory. - Add an additional [number] GB SSD to all validators to store the config directory.
@ -233,6 +241,9 @@ while [[ -n $1 ]]; do
elif [[ $1 == --tmpfs-accounts ]]; then elif [[ $1 == --tmpfs-accounts ]]; then
tmpfsAccounts=true tmpfsAccounts=true
shift shift
elif [[ $1 == --custom-memory-gb ]]; then
customMemoryGB=$2
shift 2
else else
usage "Unknown long option: $1" usage "Unknown long option: $1"
fi fi
@ -302,21 +313,26 @@ fi
case $cloudProvider in case $cloudProvider in
gce) gce)
customMemoryGB="$(cloud_DefaultCustomMemoryGB)"
if [[ "$tmpfsAccounts" = "true" ]]; then if [[ "$tmpfsAccounts" = "true" ]]; then
customMemoryGB=$(( customMemoryGB * 2 ))
cpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme" cpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme"
gpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme" gpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme"
if [[ $customMemoryGB -lt 100 ]]; then
# shellcheck disable=SC2016 # We don't want expression expansion on these backticks
echo -e '\nWarning: At least 100GB of system RAM is recommending with `--tmpfs-accounts` (see `--custom-memory-gb`)\n'
fi
fi fi
cpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB" cpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
gpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB" gpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
;; ;;
ec2|azure|colo) ec2|azure|colo)
if [[ -n $validatorAdditionalDiskSizeInGb ]] ; then if [[ -n $validatorAdditionalDiskSizeInGb ]] ; then
usage "Error: --validator-additional-disk-size-gb currently only supported with cloud provider: gce" usage "--validator-additional-disk-size-gb currently only supported with cloud provider: gce"
fi fi
if [[ "$tmpfsAccounts" = "true" ]]; then if [[ "$tmpfsAccounts" = "true" ]]; then
usage "Error: --tmpfs-accounts only supported on cloud provider: gce" usage "--tmpfs-accounts only supported on cloud provider: gce"
fi
if [[ "$customMemoryGB" != "$defaultCustomMemoryGB" ]]; then
usage "--custom-memory-gb only supported on cloud provider: gce"
fi fi
;; ;;
*) *)