-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup-world.sh
55 lines (41 loc) · 1.5 KB
/
setup-world.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
set -e
TAG=the-world:0.0.2
if [ -z "$DOCKER_REGISTRY" ]; then
( cd the-world/server && docker build -t $TAG . )
fi
if [ -n "$DOCKER_REGISTRY" ]; then
if [ -z "$WORLD_VERSION" ]; then
echo "WORLD_VERSION must be set for a registry build" >&2
exit 1
fi
TAG=$DOCKER_REGISTRY/the-world:$WORLD_VERSION
# This assumes that you have a buildx builder set up for multiplatform!
( cd the-world/server &&
docker buildx build \
--platform=linux/amd64,linux/arm64 \
--tag $TAG \
--push . )
fi
for ctx in us-east us-west eu-central; do
if [ -z "$DOCKER_REGISTRY" ]; then
k3d image import $TAG -c $ctx
fi
kubectl --context $ctx create ns world || true
sed -e "s,%TAG%,$TAG," < the-world/k8s/world-gui.yaml | \
linkerd --context $ctx inject - | \
kubectl --context $ctx apply -f -
sed -e "s,%TAG%,$TAG," < the-world/k8s/world.yaml | \
linkerd --context $ctx inject - | \
kubectl --context $ctx apply -f -
# DON'T inject the players -- they talk only to Emissary, like a
# normal out-of-cluster client would.
sed -e "s,%TAG%,$TAG," < the-world/k8s/player-$ctx.yaml | \
kubectl --context $ctx apply -f -
done
for ctx in us-east us-west eu-central; do
kubectl --context $ctx rollout status -n world deploy
done
for ctx in us-east us-west; do
kubectl apply --context $ctx -f emissary/mappings-us.yaml
done
kubectl apply --context eu-central -f emissary/mappings-eu.yaml