Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/configure-agones-tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -o xtrace
echo "#####"
CLUSTER_NAME=$1
ROOT_PATH=$2
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
echo "- Verify that the Agones pods are running -"
kubectl get pods -n agones-system -o wide
export EXTERNAL_IP=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
Expand Down
4 changes: 2 additions & 2 deletions scripts/configure-multicluster-allocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -o xtrace
export CLUSTER1=$1
export CLUSTER2=$2
export ROOT_PATH=$3
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER2})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER2}$")
export ALLOCATOR_IP_CLUSTER2=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER1}$")
export ALLOCATOR_IP_CLUSTER1=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
kubectl apply -f ${ROOT_PATH}/manifests/multicluster-allocation-1.yaml
envsubst < ${ROOT_PATH}/manifests/multicluster-allocation-1-to-2.yaml | kubectl apply -f -
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure-open-match-ingress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -o xtrace
echo "#####"
CLUSTER_NAME=$1
ROOT_PATH=$2
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
kubectl get pods -n open-match -o wide
# Create Load Balancer
kubectl expose deployment open-match-frontend -n open-match --type=LoadBalancer --name="${CLUSTER_NAME}-om-fe"
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy-director.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export REGION2=$3
export ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
export REGISTRY=${ACCOUNT_ID}.dkr.ecr.${REGION1}.amazonaws.com

kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
echo "- Create configmap -"
# Create the configmap that will store the certs/keys used by the Open Match Director to access the
# Agones Allocator Service (we use the files `client_*` and `ca_*`
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy-mapping-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ACCELERATOR_2_DNS=$(aws globalaccelerator describe-custom-routing-accelerator --

aws globalaccelerator list-custom-routing-port-mappings --region us-west-2 --accelerator-arn $ACCELERATOR_1 --query 'PortMappings[].[AcceleratorPort,DestinationSocketAddress.IpAddress,DestinationSocketAddress.Port]' | jq -c '.[] | {key: "\(.[1]):\(.[2] | tostring)", value: .[0]}' | jq -s 'from_entries' | gzip > mapping1.gz
aws globalaccelerator list-custom-routing-port-mappings --region us-west-2 --accelerator-arn $ACCELERATOR_2 --query 'PortMappings[].[AcceleratorPort,DestinationSocketAddress.IpAddress,DestinationSocketAddress.Port]' | jq -c '.[] | {key: "\(.[1]):\(.[2] | tostring)", value: .[0]}' | jq -s 'from_entries' | gzip > mapping2.gz
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME_1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME_1}$")
kubectl delete configmap global-accelerator-mapping --namespace agones-openmatch
kubectl create configmap global-accelerator-mapping --namespace agones-openmatch --from-file=mapping1.gz --from-file=mapping2.gz --from-literal=accelerator1="$ACCELERATOR_1_DNS" --from-literal=accelerator2="$ACCELERATOR_2_DNS"
rm mapping1.gz mapping2.gz
2 changes: 1 addition & 1 deletion scripts/deploy-matchfunction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ docker buildx build --platform=linux/amd64 -t $REGISTRY/agones-openmatch-mmf in
echo "- Push image to register -"
docker push $REGISTRY/agones-openmatch-mmf

kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME1}$")
echo "- Deploy Open Match mmf to cluster ${CLUSTER_NAME1} -"
envsubst < integration/matchfunction/matchfunction.yaml | kubectl apply --namespace ${NAMESPACE} -f -
echo
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy-ncat-fleets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi

docker push $REGISTRY/agones-openmatch-ncat-server

kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME1})
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}/*
Expand All @@ -39,7 +39,7 @@ 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})
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}/*
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy-stk-fleets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ docker push $REGISTRY/supertuxkart-server
echo "supertuxkart build and push was successful"

echo "- Deploy fleets to cluster ${CLUSTER_NAME1} -"
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME1}$")
export REGION=$REGION1
for f in manifests/fleets/${GAMESERVER_TYPE}/*
do
Expand All @@ -50,7 +50,7 @@ echo


echo "- Deploy fleets to cluster ${CLUSTER_NAME2} -"
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME2})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME2}$")
export REGION=$REGION2
for f in manifests/fleets/${GAMESERVER_TYPE}/*
do
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-agones-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -o xtrace
echo "#####"
CLUSTER_NAME=$1
ROOT_PATH=$2
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
echo "- Verify that the cert-manager pods are running -"
kubectl get pods -n cert-manager -o wide
echo "- Verify the cert-manager webhook is available -"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-tls-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -o xtrace
export CLUSTER_NAME=$1
export ROOT_PATH=$2
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
KEY_FILE=${ROOT_PATH}/client_${CLUSTER_NAME}.key
CERT_FILE=${ROOT_PATH}/client_${CLUSTER_NAME}.crt
TLS_CA_FILE=${ROOT_PATH}/ca_${CLUSTER_NAME}.crt
Expand Down
2 changes: 1 addition & 1 deletion scripts/set-allocator-ip.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: MIT-0
CLUSTER_NAME=$1
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME}) 2>&1 > /dev/null
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$") 2>&1 > /dev/null
ALLOCATOR_IP=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
echo ${ALLOCATOR_IP}
2 changes: 1 addition & 1 deletion scripts/test-agones-tls.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: MIT-0
export CLUSTER_NAME=$1
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
KEY_FILE=client_${CLUSTER_NAME}.key
CERT_FILE=client_${CLUSTER_NAME}.crt
TLS_CA_FILE=ca_${CLUSTER_NAME}.crt
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-gameserver-allocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "#####"
NAMESPACE=gameservers
CLUSTER_NAME=$1
REGION=$2
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME}$")
KEY_FILE=client_${CLUSTER_NAME}.key
CERT_FILE=client_${CLUSTER_NAME}.crt
TLS_CA_FILE=ca_${CLUSTER_NAME}.crt
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-gameserver-multicluster-allocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ REGION2=$4
KEY_FILE=client_${CLUSTER_NAME1}.key
CERT_FILE=client_${CLUSTER_NAME1}.crt
TLS_CA_FILE=ca_${CLUSTER_NAME1}.crt
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME1}$")
EXTERNAL_IP=$(kubectl get services agones-allocator -n agones-system -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
ENDPOINT=https://${EXTERNAL_IP}/gameserverallocation
echo "- Allocating server -"
curl ${ENDPOINT} --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} -H "Content-Type: application/json" --data '{"namespace":"'${NAMESPACE}'", "multiClusterSetting":{"enabled":true}}'
echo
echo "- Display ALLOCATED game servers on cluster ${CLUSTER_NAME1} only -"
kubectl get gameservers --namespace ${GAMESERVER_NAMESPACE} | grep Allocated
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER_NAME2})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER_NAME2}$")
echo "- Display ALLOCATED game servers on cluster ${CLUSTER_NAME2} only -"
kubectl get gameservers --namespace ${GAMESERVER_NAMESPACE} | grep Allocated
2 changes: 1 addition & 1 deletion terraform/cloudformation/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ phases:
- echo "Integrating Open Match with Agones..."
- |
cd $CODEBUILD_SRC_DIR
kubectl config use-context $(kubectl config get-contexts -o=name | grep ${CLUSTER1})
kubectl config use-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER1}$")
sh scripts/deploy-matchfunction.sh ${CLUSTER1} ${REGION1}
sh scripts/deploy-director.sh ${CLUSTER1} ${REGION1} ${REGION2}
kubectl get pods -n agones-openmatch
Expand Down
4 changes: 2 additions & 2 deletions terraform/cloudformation/cleanup-buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ phases:
# Remove the clusters from kubectl config
- |
echo "Removing clusters from kubectl config..."
kubectl config delete-context $(kubectl config get-contexts -o=name | grep ${CLUSTER1}) 2>/dev/null || echo "No kubectl context found for cluster 1"
kubectl config delete-context $(kubectl config get-contexts -o=name | grep ${CLUSTER2}) 2>/dev/null || echo "No kubectl context found for cluster 2"
kubectl config delete-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER1}$") 2>/dev/null || echo "No kubectl context found for cluster 1"
kubectl config delete-context $(kubectl config get-contexts -o=name | grep "/${CLUSTER2}$") 2>/dev/null || echo "No kubectl context found for cluster 2"
post_build:
commands:
Expand Down
7 changes: 5 additions & 2 deletions terraform/extra-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ provider "aws" {

data "aws_caller_identity" "current" {}

locals {
repo_root = "${path.module}/../.."
}

## ECR
resource "aws_ecr_replication_configuration" "cross_ecr_replication" {
Expand Down Expand Up @@ -253,7 +256,7 @@ resource "null_resource" "aga_mapping_cluster_1" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/deploy-mapping-configmap.sh ${var.cluster_1_name} ${aws_globalaccelerator_custom_routing_accelerator.aga_gs_cluster_1.id} ${var.cluster_2_name} ${aws_globalaccelerator_custom_routing_accelerator.aga_gs_cluster_2.id}&"
command = "nohup ${local.repo_root}/scripts/deploy-mapping-configmap.sh ${var.cluster_1_name} ${aws_globalaccelerator_custom_routing_accelerator.aga_gs_cluster_1.id} ${var.cluster_2_name} ${aws_globalaccelerator_custom_routing_accelerator.aga_gs_cluster_2.id}&"
}

depends_on = [
Expand All @@ -272,7 +275,7 @@ resource "null_resource" "multicluster_allocation" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/configure-multicluster-allocation.sh ${var.cluster_1_name} ${var.cluster_2_name} ${path.cwd}&"
command = "nohup ${local.repo_root}/scripts/configure-multicluster-allocation.sh ${var.cluster_1_name} ${var.cluster_2_name} ${local.repo_root}&"
}

}
13 changes: 7 additions & 6 deletions terraform/intra-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ provider "aws" {
}

locals {
repo_root = "${path.module}/../.."
name = var.cluster_name
cluster_region = var.cluster_region
gameserver_minport = 7000
Expand Down Expand Up @@ -51,8 +52,8 @@ resource "kubernetes_namespace" "this" {
provisioner "local-exec" {

when = destroy
command = "nohup ${path.cwd}/scripts/namespace-finalizer.sh ${each.key} 2>&1 &"
# command = "nohup ${path.cwd}/scripts/namespace-finalizer.sh ${var.cluster_name} ${each.key} 2>&1 &"
command = "nohup ${path.module}/../../scripts/namespace-finalizer.sh ${each.key} 2>&1 &"
# command = "nohup ${path.module}/../../scripts/namespace-finalizer.sh ${var.cluster_name} ${each.key} 2>&1 &"
}
}

Expand Down Expand Up @@ -257,7 +258,7 @@ resource "null_resource" "agones_tls_configuration" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/configure-agones-tls.sh ${local.name} ${path.cwd}&"
command = "nohup ${local.repo_root}/scripts/configure-agones-tls.sh ${local.name} ${local.repo_root}&"
}

depends_on = [
Expand All @@ -275,7 +276,7 @@ resource "null_resource" "allocator_tls_files" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/generate-tls-files.sh ${var.cluster_name} ${path.cwd} &"
command = "nohup ${local.repo_root}/scripts/generate-tls-files.sh ${var.cluster_name} ${local.repo_root} &"
}

depends_on = [
Expand All @@ -294,7 +295,7 @@ resource "null_resource" "open_match_ingress_configuration" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/configure-open-match-ingress.sh ${var.cluster_name} ${path.cwd} &"
command = "nohup ${local.repo_root}/scripts/configure-open-match-ingress.sh ${var.cluster_name} ${local.repo_root} &"
}

depends_on = [
Expand All @@ -311,7 +312,7 @@ resource "null_resource" "generate_agones_certs" {

provisioner "local-exec" {
when = create
command = "nohup ${path.cwd}/scripts/generate-agones-certs.sh ${var.cluster_name} ${path.cwd} &"
command = "nohup ${local.repo_root}/scripts/generate-agones-certs.sh ${var.cluster_name} ${local.repo_root} &"
}

depends_on = [
Expand Down
Loading