Private IP networks now work, and are the default
This commit is contained in:
24
net/gce.sh
24
net/gce.sh
@ -17,7 +17,7 @@ clientMachineType=n1-standard-16
|
||||
clientAccelerator=
|
||||
|
||||
imageName="ubuntu-16-04-cuda-9-2-new"
|
||||
internalNetwork=false
|
||||
publicNetwork=false
|
||||
zone="us-west1-b"
|
||||
|
||||
usage() {
|
||||
@ -42,7 +42,7 @@ Configure a GCE-based testnet
|
||||
create-specific options:
|
||||
-n number - Number of validator nodes (default: $validatorNodeCount)
|
||||
-c number - Number of client nodes (default: $clientNodeCount)
|
||||
-P - Use GCE internal/private network (default: $internalNetwork)
|
||||
-P - Use public network IP addresses (default: $publicNetwork)
|
||||
-z - GCP Zone for the nodes (default: $zone)
|
||||
-i imageName - Existing image on GCE (default: $imageName)
|
||||
-g - Enable GPU
|
||||
@ -72,7 +72,7 @@ while getopts "h?p:Pi:n:c:z:g" opt; do
|
||||
prefix=$OPTARG
|
||||
;;
|
||||
P)
|
||||
internalNetwork=true
|
||||
publicNetwork=true
|
||||
;;
|
||||
i)
|
||||
imageName=$OPTARG
|
||||
@ -97,9 +97,12 @@ done
|
||||
|
||||
|
||||
prepareInstancesAndWriteConfigFile() {
|
||||
echo "# autogenerated at $(date)" >> "$configFile"
|
||||
|
||||
echo "netBasename=$prefix" >> "$configFile"
|
||||
cat >> "$configFile" <<EOF
|
||||
# autogenerated at $(date)
|
||||
netBasename=$prefix
|
||||
publicNetwork=$publicNetwork
|
||||
EOF
|
||||
|
||||
declare sshPrivateKey="$netConfigDir/id_$prefix"
|
||||
rm -rf "$sshPrivateKey"{,.pub}
|
||||
@ -116,10 +119,13 @@ prepareInstancesAndWriteConfigFile() {
|
||||
|
||||
declare arrayName="$6"
|
||||
|
||||
if $internalNetwork; then
|
||||
echo "$arrayName+=($privateIp) # $name" >> "$configFile"
|
||||
else
|
||||
echo "$arrayName+=($publicIp) # $name" >> "$configFile"
|
||||
echo "$arrayName+=($publicIp) # $name" >> "$configFile"
|
||||
if [[ $arrayName = "leaderIp" ]]; then
|
||||
if $publicNetwork; then
|
||||
echo "entrypointIp=$publicIp" >> "$configFile"
|
||||
else
|
||||
echo "entrypointIp=$privateIp" >> "$configFile"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user