Skip to content

Commit

Permalink
Better cluster commands
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnedo committed Jul 6, 2024
1 parent 560d7af commit 3927d35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ aarch64:
cross build --target aarch64-unknown-linux-gnu
.PHONY: amd64 # on mac
amd64:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc cargo build --target=x86_64-unknown-linux-gnu
cross build --target=x86_64-unknown-linux-gnu

19 changes: 14 additions & 5 deletions play/clusterplz → hack/clusterplz
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ done
nodes=2

stop_nodes() {
node_names=$(seq $nodes|sed 's/^/node-/'|xargs)
node_names=$(seq $nodes | sed 's/^/node-/' | xargs)
multipass stop $node_names
}

start_nodes() {
node_names=$(seq $nodes|sed 's/^/node-/'|xargs)
node_names=$(seq $nodes | sed 's/^/node-/' | xargs)
multipass start $node_names
}

Expand Down Expand Up @@ -85,9 +85,11 @@ ips)
done
;;
restore)
stop_nodes
for f in $(seq $nodes); do
multipass restore -d "node-${f}.in"
multipass restore -d "node-${f}.snapshot1"
done
start_nodes
;;
start)
start_nodes
Expand All @@ -96,7 +98,7 @@ stop)
stop_nodes
;;
remove)
node_names=$(seq $nodes|sed 's/^/node-/'|xargs)
node_names=$(seq $nodes | sed 's/^/node-/' | xargs)
multipass delete --purge $node_names
;;
shell)
Expand All @@ -113,11 +115,18 @@ shell)
tmux attach-session -t $SESSION
;;
skate)
set -euo pipefail
for f in $(seq $nodes); do
info=$(multipass info node-$f)
ip=$(echo "$info" | grep -e '^IPv4:' | awk '{print $2}')
name=$(echo "$info" | grep -e '^Name:' | awk '{print $2}')
echo skate create node --name $name --host $ip --subnet-cidr "20.${f}.0.0/16"
cargo run --bin skate create node --name $name --host $ip --subnet-cidr "20.${f}.0.0/16"
done
;;
skatelet)
for f in $(seq $nodes); do
multipass transfer target/aarch64-unknown-linux-gnu/debug/skatelet node-$f:
multipass exec -n node-$f -- sudo mv skatelet /usr/local/bin/skatelet
done
;;
esac

0 comments on commit 3927d35

Please sign in to comment.