forked from AI-Hypercomputer/maxtext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preflight.sh
31 lines (27 loc) · 691 Bytes
/
preflight.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
echo "Running preflight.sh"
# Command Flags:
# PLATFORM (Required, must be "gke" or "gce")
#
# Example to invoke this script:
# bash preflight.sh PLATFORM=gke
# Stop execution if any command exits with error
set -e
# Set environment variables
for ARGUMENT in "$@"; do
IFS='=' read -r KEY VALUE <<< "$ARGUMENT"
export "$KEY"="$VALUE"
done
if [ -z $PLATFORM ]; then
echo "Error: PLATFORM flag is missing."
exit 1
fi
if [[ $PLATFORM == "gce" ]]; then
# Set up network for running on gce
echo "Setting up network for GCE"
bash rto_setup.sh
else
# Set up network for running on gke
echo "Setting up network for GKE"
bash gke_rto_setup.sh
fi