The original work is Laremere/space-agon.
Space Agon is a integrated demo of Agones and Open Match.
Be aware of billing charges for running the cluster.
Space Agon is intended to run on Google Kubernetes Engine (GKE) and has been tested with the configured cluster size.
Leaving the cluster running may incur your cost. You need to be responsible for the cost. (See pricings of GKE, Cloud Build and Artifact Registry.)
Create your Google Cloud Project.
Install tools in your dev environment:
- gcloud
- docker
- kubectl
- envsubst
- skaffold (Optional)
- helm (Optional)
- minikube (Optional)
- hyperkit (Optional)
Google Cloud Shell has all tools you need.
# Set Your Project ID before you run
$ export PROJECT_ID=<your project ID>
$ export LOCATION=us-central1
$ export ZONE=$LOCATION-a
$ export REPOSITORY=space-agon
$ gcloud services enable artifactregistry.googleapis.com \
container.googleapis.com
$ gcloud config set project $PROJECT_ID
$ gcloud config set compute/zone $ZONE
# Create cluster (using default network)
# Set NETWORK=<your network>, if you want to select the network
$ make gcloud-test-cluster
# Create Artifact Registry Repository
$ gcloud artifacts repositories create $REPOSITORY \
--repository-format=docker \
--location=$LOCATION
# Assign roles to default service account
$ gcloud projects add-iam-policy-binding $PROJECT_ID \
--member serviceAccount:$(gcloud iam service-accounts list \
--filter="displayName:Compute Engine default service account" \
--format="value(email)") \
--role roles/artifactregistry.reader
# Login Artifact Registry
$ gcloud auth configure-docker $LOCATION-docker.pkg.dev
# Install Agones
$ make agones-install
# Install Open Match
$ make openmatch-install
# Start minikube
# ref: https://minikube.sigs.k8s.io/docs/commands/start/
$ minikube start --cpus="2" --memory="4096" --kubernetes-version=v1.23.14 --driv
er=hyperkit
# Install minimized Agones
$ make agones-install-local
# Install minimized Open Match
$ make openmatch-install-local
Make sure you installed docker to build and push images
# Build space-agon images
make build
# Apply space-agon images
make install
# Build space-agon images for minikube cluster
make build-local
# Apply space-agon images for minikube cluster
make install
Get External IP from:
$ kubectl get service frontend
When you run space-agone in minikube, you should followings in another terminal:
$ minikube tunnel
Open http://<external ip>/
in your favorite web browser. You can use "find
match" to start searching for a match.
Repeat in a second web browser window to create a second player, the players will be connected and can play each other.
View Running Game Servers:
$ kubectl get gameserver
Then use the connect to server option with the value <ip>:<port>
.
$ make uninstall
# Deployed space-agone to Google Cloud
$ make agones-uninstall
# Deployed space-agone to minikube
$ make agones-uninstall-local
# Deployed space-agone to Google Cloud
make openmatch-uninstall
# Deployed space-agone to minikube
$ make openmatch-uninstall-local
$ gcloud projects delete $PROJECT_ID
In case testing your original match making logics, skaffold
can help you debug your applications.
- Create a space-agon k8s cluster.
- Install
skaffold
if you haven't. - Run
make skaffold-setup
on the project root to make askaffold.yaml
Now you're ready to run skaffold
commands.
Once you create a skaffold.yaml
, you can run skaffold
commands.
You can check your own logic and debug.
# Build space-agon images with Cloud Build
$ skaffold build
# Run Applicaitons in the space-agon cluster for debugging.
$ skaffold dev
Modifying applications during skaffold dev
triggers Build and Deploy automatically. For more commands and details, visit skaffold
.
When you would like to test the application, follow the steps below.
- Install
skaffold
if you haven't. - Create a space-agon k8s cluster.
- Run
make skaffold-setup
on the project root to make askaffold.yaml
- Run below commands for integration test.
# Run you space-agon applications
$ skaffold dev
# Open another terminal and
# Run Test command
$ make integration-test
# Connect to service in minikube
$ minikube tunnel
# Open another terminal and
# Run Test command
$ make integration-test
This is Apache 2.0 License.
This is not an officially supported Google product.