forked from aws-solutions-library-samples/guidance-for-game-server-hosting-using-agones-and-open-match-on-amazon-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-ncat-fleets.sh
More file actions
executable file
·53 lines (48 loc) · 2.02 KB
/
deploy-ncat-fleets.sh
File metadata and controls
executable file
·53 lines (48 loc) · 2.02 KB
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
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: MIT-0
export GAMESERVER_TYPE=ncat
export NAMESPACE=gameservers
export CLUSTER_NAME1=$1
export REGION1=$2
export CLUSTER_NAME2=$3
export REGION2=$4
export ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
export REGISTRY=${ACCOUNT_ID}.dkr.ecr.${REGION1}.amazonaws.com
export ARCHITECTURE=$5
aws ecr get-login-password --region ${REGION1} | docker login --username AWS --password-stdin $REGISTRY
#docker buildx build --platform=linux/amd64 -t $REGISTRY/agones-openmatch-ncat-server integration/ncat-server
#docker buildx build --platform=linux/arm64 -t $REGISTRY/agones-openmatch-ncat-server integration/ncat-server
echo "Architecture is" $ARCHITECTURE
if [[ $ARCHITECTURE == "arm64" ]];
then
docker buildx build --platform=linux/arm64 -t $REGISTRY/agones-openmatch-ncat-server integration/ncat-server
echo "building arm64 version";
else
docker buildx build --platform=linux/amd64 -t $REGISTRY/agones-openmatch-ncat-server integration/ncat-server
echo "building amd64 version";
fi
docker push $REGISTRY/agones-openmatch-ncat-server
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME1}$")
export REGION=$REGION1
echo "- Deploy fleets to cluster ${CLUSTER_NAME1} -"
for f in manifests/fleets/${GAMESERVER_TYPE}/*
do
envsubst < $f | kubectl apply --namespace ${NAMESPACE} -f -
done
echo
echo "- Display fleets and game servers -"
kubectl get fleets --namespace ${NAMESPACE}
kubectl get gameservers --namespace ${NAMESPACE} --show-labels
echo
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME2}$")
export REGION=$REGION2
echo "- Deploy fleets to cluster ${CLUSTER_NAME2} -"
for f in manifests/fleets/${GAMESERVER_TYPE}/*
do
envsubst < $f | kubectl apply --namespace ${NAMESPACE} -f -
done
echo
# echo "- Display fleets and game servers -"
kubectl get fleets --namespace ${NAMESPACE}
kubectl get gameservers --namespace ${NAMESPACE} --show-labels
echo