Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
120349: drtprod: capture cluster creation in script r=dt a=dt

See commits.

Co-authored-by: David Taylor <[email protected]>
  • Loading branch information
craig[bot] and dt committed Mar 12, 2024
2 parents 01dc057 + e8c3cc6 commit f226170
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions scripts/drtprod
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env bash

set -euo pipefail

# drtprod is a wrapper for roachprod for use when managing the long-lived DRT
# clusters that ensures consistent use of the correct project-assignment vars
# and done some additional sanity check enforcement on some flags.

export GCE_PROJECT=cockroach-drt
export ROACHPROD_DNS="drt.crdb.io"

case $1 in
"start")
if [[ "$*" != *"--secure"* ]]; then
Expand All @@ -26,8 +31,7 @@ case $1 in
# wrapper.
shift
cluster=$1
set -euo pipefail
GCE_PROJECT=cockroach-drt roachprod adminurl $cluster |
roachprod adminurl $cluster --ips |
awk '{printf "%04d\t%s\n", NR, $0}' | # prepend the padded node IDs.
sed -e 's,http://\(.*\):26258/,\1,g' | # remove the HTTP part.
while read node ip; do
Expand All @@ -36,7 +40,46 @@ case $1 in
--type="A" --zone="drt" --ttl=60
done
exit 0
;;
"create")
if [ "$#" -lt 2 ]; then
echo "usage: $0 create {ua-1,ua-2}"
exit 1
fi
case "${2}" in
"ua-1")
roachprod create ua-1 \
--clouds gce \
--gce-zones "us-east1-b" \
--nodes 9 \
--gce-machine-type n2-standard-8 \
--gce-pd-volume-size 5000 --local-ssd=false \
--username ua \
--lifetime 8760h
# setup dns
$0 dns ua-1
;;
"ua-2")
roachprod create ua-2 \
--clouds gce \
--gce-zones "us-east1-b" \
--nodes 9 \
--gce-machine-type n2-standard-8 \
--gce-pd-volume-size 5000 --local-ssd=false \
--username ua \
--lifetime 8760h
# setup dns
$0 dns ua-2
;;
*)
echo
echo "ATN: If $2 is intended to be long-lived, please define it by name in $0 instead."
echo
exec roachprod "$@"
;;
esac
exit 0
esac


GCE_PROJECT=cockroach-drt ROACHPROD_DNS="drt.crdb.io" roachprod "$@"
roachprod "$@"

0 comments on commit f226170

Please sign in to comment.