From 48cac97ce43c357fdcda1545a3639b2bd960afc6 Mon Sep 17 00:00:00 2001 From: Damian Lance Date: Fri, 12 Apr 2024 13:06:47 -0700 Subject: [PATCH] Added learner yaml skeletons and removed unneeded files for the hack --- COMMANDS.md | 67 --------- Dockerfile.build-protos | 37 ----- Makefile | 312 ---------------------------------------- README.md | 296 +------------------------------------- allocation.yaml | 20 --- build_protos.sh | 25 ---- director.yaml | 72 ++++++++++ fleet.yaml | 1 + frontend.yaml | 4 + gameserver.yaml | 1 + mmf.yaml | 4 + 11 files changed, 86 insertions(+), 753 deletions(-) delete mode 100644 COMMANDS.md delete mode 100644 Dockerfile.build-protos delete mode 100644 Makefile delete mode 100644 allocation.yaml delete mode 100644 build_protos.sh create mode 100644 director.yaml create mode 100644 fleet.yaml create mode 100644 frontend.yaml create mode 100644 gameserver.yaml create mode 100644 mmf.yaml diff --git a/COMMANDS.md b/COMMANDS.md deleted file mode 100644 index bc54a209..00000000 --- a/COMMANDS.md +++ /dev/null @@ -1,67 +0,0 @@ -These are some additional commands which are useful for development. - -Generate components file: -``` -go generate github.com/googleforgames/space-agon/game/generation -``` - -Rebuild proto generates files: -``` -docker build -f=Dockerfile.build-protos -t build-protos . && docker run --rm --mount type=bind,source="$(pwd)",target=/workdir/mount build-protos -``` - -Mother of all commands: -``` - -# Once -docker build -f=Dockerfile.build-protos -t build-protos . - -# Every update - -go generate github.com/googleforgames/space-agon/game/generation && \ -docker run --rm --mount type=bind,source="$(pwd)",target=/workdir/mount build-protos && \ -TAG=$(date +INDEV-%Y%m%d-%H%M%S) && \ -REGISTRY=gcr.io/$(gcloud config list --format 'value(core.project)') && \ -GOOS=js GOARCH=wasm go test github.com/googleforgames/space-agon/client/... && \ -go test github.com/googleforgames/space-agon/... - - - - - - && \ -docker build . -f Frontend.Dockerfile -t $REGISTRY/space-agon-frontend:$TAG && \ -docker build . -f Dedicated.Dockerfile -t $REGISTRY/space-agon-dedicated:$TAG && \ -docker build . -f Director.Dockerfile -t $REGISTRY/space-agon-director:$TAG && \ -docker build . -f Mmf.Dockerfile -t $REGISTRY/space-agon-mmf:$TAG && \ -docker push $REGISTRY/space-agon-frontend:$TAG && \ -docker push $REGISTRY/space-agon-dedicated:$TAG && \ -docker push $REGISTRY/space-agon-director:$TAG && \ -docker push $REGISTRY/space-agon-mmf:$TAG && \ -ESC_REGISTRY=$(echo $REGISTRY | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g') && \ -ESC_TAG=$(echo $TAG | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g') && \ -sed -E 's/image: (.*)\/([^\/]*):(.*)/image: '$ESC_REGISTRY'\/\2:'$ESC_TAG'/' deploy_template.yaml > deploy.yaml && \ -kubectl apply -f deploy.yaml -``` - -Run locally -``` -# Gameserver - RUN FIRST - -go generate github.com/googleforgames/space-agon/game/generation && \ -docker run --rm --mount type=bind,source="$(pwd)",target=/workdir/mount build-protos && \ -go test github.com/googleforgames/space-agon/... && \ -docker build . -f Dedicated.Dockerfile -t space-agon-dedicated && \ -docker run -p 2156:2156/tcp -e DISABLE_AGONES=true space-agon-dedicated - -# Frontend - RUN SECOND - -GOOS=js GOARCH=wasm go test github.com/googleforgames/space-agon/client/... && \ -go test github.com/googleforgames/space-agon/... && \ -docker build . -f Frontend.Dockerfile -t space-agon-frontend && \ -docker run -p 2157:8080/tcp space-agon-frontend - -``` - - -This is not an officially supported Google product. diff --git a/Dockerfile.build-protos b/Dockerfile.build-protos deleted file mode 100644 index d21837db..00000000 --- a/Dockerfile.build-protos +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Versions last updated on 2023-04-18. All installs must use specific versions -# for reproducable builds. -# When updating, follow the instructions on all to update comments. - -# To update, find the highest but most specific version tag on -# https://hub.docker.com/_/golang -FROM golang:1.21.5-alpine3.19 -ENV GO111MODULE=on - -WORKDIR /workdir - -# No versioning needed, and versioning alpine also versions these packages. -# Install protobuf-compiler -RUN apk add --no-cache protoc protobuf-dev && protoc --version - -# Install protocol compiler plugins -RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 && \ - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 - -COPY build_protos.sh . -RUN chmod +x build_protos.sh - -ENTRYPOINT /workdir/build_protos.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index a67498d8..00000000 --- a/Makefile +++ /dev/null @@ -1,312 +0,0 @@ -# Copyright 2022 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# __ __ _ _ _ -# \ \ / /_ _ _ __(_) __ _| |__ | | ___ ___ -# \ \ / / _` | '__| |/ _` | '_ \| |/ _ \ __| -# \ V / (_| | | | | (_| | |_) | | __\__ \ -# \_/ \__,_|_| |_|\__,_|_.__/|_|\___|___/ -# - -PROJECT=$(shell gcloud config list --format 'value(core.project)') -LOCATION=us-central1 -REPOSITORY=space-agon -REGISTRY=${LOCATION}-docker.pkg.dev/${PROJECT}/${REPOSITORY} -TAG=$(shell git rev-parse --short HEAD) - -FRONTEND_IMG=space-agon-frontend -DIRECTOR_IMG=space-agon-director -DEDICATED_IMG=space-agon-dedicated -MMF_IMG=space-agon-mmf - -AGONES_NS:=agones-system -OM_NS:=open-match -AGONES_VER:=1.36.0 -OM_VER:=1.8.1 -K8S_VERSION:=1.27 - -# _____ _ -# |_ _|_ _ _ __ __ _ ___| |_ ___ -# | |/ _` | '__/ _` |/ _ \ __/ __| -# | | (_| | | | (_| | __/ |_\__ \ -# |_|\__,_|_| \__, |\___|\__|___/ -# |___/ - -# help output -.PHONY: help -help: - @echo "" - @echo "Build Docker images in local environment" - @echo " make build-local" - @echo "" - @echo "Build Docker images" - @echo " make build" - @echo "" - @echo "Create GKE Cluster" - @echo " make gcloud-test-cluster" - @echo "" - @echo "Add Helm Repositories" - @echo " make helm-repo-add" - @echo "" - @echo "Remove Helm Repositories" - @echo " make helm-repo-remove" - @echo "" - @echo "Install Agones in local-cluster" - @echo " make agones-install-local" - @echo "" - @echo "Install Agones" - @echo " make agones-install" - @echo "" - @echo "Install Open Match in local-cluster" - @echo " make openmatch-install-local" - @echo "" - @echo "Install Open Match" - @echo " make openmatch-install" - @echo "" - @echo "Install Space Agon" - @echo " make install" - @echo "" - @echo "Install Space Agon on minikube" - @echo " make install-local" - @echo "" - @echo "Uninstall Agones" - @echo " make agones-uninstall" - @echo "" - @echo "Uninstall Open Match" - @echo " make openmatch-uninstall" - @echo "" - @echo "Upgrade Space Agon parameters" - @echo " make upgrade" - @echo "" - @echo "Uninstall Space Agon" - @echo " make uninstall" - @echo "" - @echo "Setup skaffold for GKE" - @echo " make skaffold-setup" - @echo "" - @echo "Setup skaffold for local cluster" - @echo " make skaffold-setup-local" - @echo "" - @echo "Run unit test" - @echo " make test" - @echo "" - @echo "Run integration test" - @echo " make integration-test" - @echo "" - -# build space-agon docker images in local -.PHONY: build-local -build-local: - ./scripts/build.sh test \ - ${TAG} \ - ${FRONTEND_IMG} \ - ${DEDICATED_IMG} \ - ${DIRECTOR_IMG} \ - ${MMF_IMG} \ - ${REGISTRY} - -# build space-agon docker images -.PHONY: build -build: - ./scripts/build.sh develop \ - ${TAG} \ - ${FRONTEND_IMG} \ - ${DEDICATED_IMG} \ - ${DIRECTOR_IMG} \ - ${MMF_IMG} \ - ${REGISTRY} - -# create gke cluster -.PHONY: gcloud-test-cluster -gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT ?= 4 -gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_MACHINETYPE ?= e2-standard-4 -gcloud-test-cluster: NETWORK ?= default -gcloud-test-cluster: - ./scripts/create-cluster.sh ${GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT} \ - ${GCP_CLUSTER_NODEPOOL_MACHINETYPE} \ - ${LOCATION} \ - ${NETWORK} \ - ${K8S_VERSION} - -.PHONY: helm-repo-add -helm-repo-add: - helm repo add $(AGONES_NS) https://agones.dev/chart/stable - helm repo add $(OM_NS) https://open-match.dev/chart/stable - helm repo update - -.PHONY: helm-repo-remove -helm-repo-remove: - helm repo remove $(AGONES_NS) - helm repo remove $(OM_NS) - -# install agones in local-cluster -.PHONY: agones-install-local -agones-install-local: - helm install $(AGONES_NS) --namespace $(AGONES_NS) \ - --create-namespace $(AGONES_NS)/agones \ - --version $(AGONES_VER) \ - --set agones.ping.install=false \ - --set agones.controller.replicas=1 \ - --set agones.extensions.replicas=1 \ - --set agones.allocator.replicas=0 - -# install agones -.PHONY: agones-install -agones-install: - helm install ${AGONES_NS} --namespace ${AGONES_NS} \ - --create-namespace $(AGONES_NS)/agones \ - --version ${AGONES_VER} - -# uninstall agones and agones resources -.PHONY: agones-uninstall -agones-uninstall: - helm uninstall $(AGONES_NS) --namespace $(AGONES_NS) - kubectl delete namespace $(AGONES_NS) - -# install open-match in local-cluster -.PHONY: openmatch-install-local -openmatch-install-local: - helm install $(OM_NS) \ - --create-namespace --namespace $(OM_NS) $(OM_NS)/open-match \ - --version $(OM_VER) \ - --set open-match-customize.enabled=true \ - --set open-match-customize.evaluator.enabled=true \ - --set open-match-customize.evaluator.replicas=1 \ - --set open-match-override.enabled=true \ - --set open-match-core.swaggerui.enabled=false \ - --set global.kubernetes.horizontalPodAutoScaler.frontend.maxReplicas=1 \ - --set global.kubernetes.horizontalPodAutoScaler.backend.maxReplicas=1 \ - --set global.kubernetes.horizontalPodAutoScaler.query.minReplicas=1 \ - --set global.kubernetes.horizontalPodAutoScaler.query.maxReplicas=1 \ - --set global.kubernetes.horizontalPodAutoScaler.evaluator.maxReplicas=1 \ - --set query.replicas=1 \ - --set frontend.replicas=1 \ - --set backend.replicas=1 \ - --set redis.master.resources.requests.cpu=0.1 \ - --set redis.replica.replicaCount=0 \ - --set redis.metrics.enabled=false - -# install open-match -.PHONY: openmatch-install -openmatch-install: - helm install ${OM_NS} --create-namespace --namespace \ - ${OM_NS} $(OM_NS)/open-match \ - --version ${OM_VER} \ - --set open-match-customize.enabled=true \ - --set open-match-customize.evaluator.enabled=true \ - --set open-match-customize.evaluator.replicas=1 \ - --set open-match-override.enabled=true \ - --set open-match-core.swaggerui.enabled=false \ - --set redis.sentinel.enabled=false \ - --set redis.master.resources.requests.cpu=0.1 \ - --set redis.master.persistence.enabled=false \ - --set redis.replica.replicaCount=0 \ - --set redis.metrics.enabled=false - -# uninstall open-match -.PHONY: openmatch-uninstall -openmatch-uninstall: - helm uninstall -n ${OM_NS} ${OM_NS} - kubectl delete namespace ${OM_NS} - -.PHONY: skaffold-setup-local -skaffold-setup-local: - ./scripts/setup-skaffold.sh \ - ${PROJECT} \ - local \ - ${FRONTEND_IMG} \ - ${DEDICATED_IMG} \ - ${DIRECTOR_IMG} \ - ${MMF_IMG} \ - ${LOCATION} - -.PHONY: skaffold-setup -skaffold-setup: - ./scripts/setup-skaffold.sh \ - ${PROJECT} \ - ${REGISTRY} \ - ${FRONTEND_IMG} \ - ${DEDICATED_IMG} \ - ${DIRECTOR_IMG} \ - ${MMF_IMG} \ - ${LOCATION} - -# install space-agon itself -.PHONY: install -install: - helm install space-agon \ - -f install/helm/space-agon/values.yaml \ - --set frontend.image.repository="${REGISTRY}/${FRONTEND_IMG}" \ - --set frontend.image.tag=${TAG} \ - --set dedicated.image.repository="${REGISTRY}/${DEDICATED_IMG}" \ - --set dedicated.image.tag=${TAG} \ - --set director.image.repository="${REGISTRY}/${DIRECTOR_IMG}" \ - --set director.image.tag=${TAG} \ - --set mmf.image.repository="${REGISTRY}/${MMF_IMG}" \ - --set mmf.image.tag=${TAG} \ - --set frontend.replicas=2 \ - --set dedicated.replicas=2 \ - --set mmf.replicas=2 \ - --set dedicated.resources.limits.cpu="500m" \ - --set dedicated.resources.limits.memory="200Mi" \ - --set dedicated.resources.requests.cpu="500m" \ - --set dedicated.resources.requests.memory="200Mi" \ - --set dedicated.autoscaler.buffer.bufferSize=2 \ - --set dedicated.autoscaler.buffer.minReplicas=0 \ - --set dedicated.autoscaler.buffer.maxReplicas=50 \ - ./install/helm/space-agon - -.PHONY: install-local -install-local: - helm install space-agon \ - -f install/helm/space-agon/values.yaml \ - --set frontend.image.repository="local/${FRONTEND_IMG}" \ - --set frontend.image.tag=${TAG} \ - --set dedicated.image.repository="local/${DEDICATED_IMG}" \ - --set dedicated.image.tag=${TAG} \ - --set director.image.repository="local/${DIRECTOR_IMG}" \ - --set director.image.tag=${TAG} \ - --set mmf.image.repository="local/${MMF_IMG}" \ - --set mmf.image.tag=${TAG} \ - --set frontend.replicas=1 \ - --set dedicated.replicas=1 \ - --set mmf.replicas=1 \ - --set dedicated.resources.limits.cpu="100m" \ - --set dedicated.resources.limits.memory="100Mi" \ - --set dedicated.resources.requests.cpu="100m" \ - --set dedicated.resources.requests.memory="100Mi" \ - --set dedicated.autoscaler.buffer.bufferSize=1 \ - --set dedicated.autoscaler.buffer.minReplicas=0 \ - --set dedicated.autoscaler.buffer.maxReplicas=1 \ - ./install/helm/space-agon - -# uninstall space-agon itself -.PHONY: uninstall -uninstall: - helm uninstall space-agon - -# upgrade space-agon after changing parameters -.PHONY: upgrade -upgrade: - helm upgrade space-agon -f install/helm/space-agon/values.yaml ./install/helm/space-agon - -# unit test -.PHONY: test -test: - go test ./frontend/ ./mmf/ ./director/ ./dedicated/ ./game/protostream/ - -# integration test -.PHONY: integration-test -integration-test: - go test -count=1 -v -timeout 60s test/integration_test.go diff --git a/README.md b/README.md index 91f58b15..98ac9619 100644 --- a/README.md +++ b/README.md @@ -1,292 +1,4 @@ -The original work is [Laremere/space-agon](https://github.com/Laremere/space-agon). - -# Space Agon - -Space Agon is a integrated demo of [Agones](https://agones.dev/) and -[Open Match](https://open-match.dev/). - -Space Agon Game - -## Before Trying - -**Be aware of billing charges for running the cluster.** - -Space Agon is intended to run on [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engine) 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](https://cloud.google.com/kubernetes-engine/pricing), [Cloud Build](https://cloud.google.com/build/pricing) and [Artifact Registry](https://cloud.google.com/artifact-registry/pricing).) - -## Prerequisites - -Create your [Google Cloud Project](https://cloud.google.com/). - -Install tools in your dev environment: - -- [gcloud](https://cloud.google.com/sdk/gcloud) -- [docker](https://www.docker.com/) -- [kubectl](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_kubectl) -- [helm](https://helm.sh/) -- [skaffold](https://skaffold.dev/) (Optional) -- [envsubst](https://linux.die.net/man/1/envsubst) -- [minikube](https://minikube.sigs.k8s.io/docs/start/) (Optional) -- [hyperkit](https://github.com/moby/hyperkit) (Optional) - -_[Google Cloud Shell](https://cloud.google.com/shell) has all tools you need._ - -## Create the Resources and Install Gaming OSS - -### Deploy them to Google Cloud - -```bash -# Set Your Project ID before you run -export 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=, 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 - -# Add Helm Repositories -make helm-repo-add - -# Install Agones -make agones-install - -# Install Open Match -make openmatch-install -``` - -### Deploy them to local k8s cluster by minikube - -```bash -# Start minikube -# ref: https://minikube.sigs.k8s.io/docs/commands/start/ -# Or you can other dirvers -minikube start --cpus="2" --memory="4096" --kubernetes-version=v1.25.15 --driver=hyperkit - -# Add Helm Repositories -make helm-repo-add - -# Install minimized Agones -make agones-install-local - -# Install minimized Open Match -make openmatch-install-local -``` - -## Deploy applications - -### Deploy to Google Cloud - -Make sure you installed docker to build and push images - -```bash -# Build Space Agon images -make build - -# Deploy Space Agon -make install -``` - -### Deploy to local k8s cluster by minikube - -```bash -# Build Space Agon images for minikube cluster -make build-local - -# Deploy Space Agon for minikube cluster -make install -``` - -## View and Play - -Get External IP from: - -```bash -kubectl get service frontend -``` - -When you run Space Agon in minikube, you should followings in another terminal: - -```bash -minikube tunnel -``` - -Open `http:///` in your favorite web browser. You can use "Find Game" to start searching for a match. - -Space Agon Title - -Repeat in a second web browser window to create a second player, the players -will be connected and can play each other. - -## Access GameServer - -View Running Game Servers: - -```bash -kubectl get gameserver -``` - -Then use the connect to server option with the value `:`. - -## Changing the parameters - -If you'd like to modify your parameters of your deployments, you can change in [`install/helm/space-agon/values.yaml`](./install/helm/space-agon/values.yaml) or use `--set` parameters directly. - -Space Agon uses [Helm](https://helm.sh/) to install the applications. - -```yaml -# values.yaml -frontend: - name: frontend - replicas: 2 - containerPort: 8080 - servicePort: 80 - serviceType: LoadBalancer - image: - repository: YOUR_REPO_NAME_HERE - tag: YOUR_TAG_HERE -... -``` - -## Clean Up - -### Delete the deployment - -```bash -# Uninstall Space Agon Applications -make uninstall -``` - -### Uninstall Agones - -```bash -make agones-uninstall -``` - -### Uninstall Open-Match - -```bash -make openmatch-uninstall -``` - -### (Optional) Remove Helm Repositories - -You can remove Helm repositories by the command, if you do not need. - -```bash -make helm-repo-remove -``` - -### Delete your Google Cloud Project - -```bash -# Delete project -gcloud projects delete $PROJECT_ID -``` - -## (Optional) Develop Applications with Skaffold - -In case testing your original match making logics, [`skaffold`](https://skaffold.dev/) can help you debug your applications. - -### Setup - -1. [Create a Space Agon cluster.](#create-the-resources-and-install-gaming-oss) -1. [Install `skaffold`](https://skaffold.dev/docs/install/) - -After running `make build` or `make build-local`, you're ready to run `skaffold` commands. - -### Develop - -Once you create a `skaffold.yaml`, you can run `skaffold` commands. - -```bash -# You need envsubst for setting up a skaffold file -# Setup skaffold - -make skaffold-setup - -# For local development - -make skaffold-setup-local - -# Build Space Agon images with Cloud Build -skaffold build - -# Run Applicaitons in the local Space Agon cluster for debugging. -skaffold dev - -# Use cloud profile in case of GKE (Run `make build` first) -skaffold dev -p cloud - -# Check your deployed yaml file -skaffold render -``` - -Modifying applications or helm values during `skaffold dev` triggers Build and Deploy again automatically. -For more commands and details, visit [`skaffold`](https://skaffold.dev/). - -## Test your Cluster - -When you would like to test the application, follow the steps below. - -### Google Cloud - -1. [Create a Space Agon k8s cluster](#create-the-resources-and-install-gaming-oss). -1. Run below commands for integration test. - -```bash -# Run you Space Agon applications -# Optiionally, you can use `skaffold dev` -make install - -# Open another terminal and -# Run Test command -make integration-test -``` - -### minikube - -1. [Create a Space Agon k8s cluster on minikube](#create-the-resources-and-install-gaming-oss). -1. Run below commands for integration test. - -```bash -# Connect to service in minikube -minikube tunnel - -# Open another terminal and -# Run Test command -make integration-test -``` - -## LICENSE - -This is [Apache 2.0 License](./LICENSE). - -## Note - -This is not an officially supported Google product. +Space Agon is a demo integration of [Agones](https://agones.dev/) and +[Open Match](https://open-match.dev/). This repository is meant for +those participating in the [Gaming on Google Cloud](https://ghacks.dev/hacks/gaming-on-gcp/) +gHack. Scale down or delete cluster resources when you are finished. \ No newline at end of file diff --git a/allocation.yaml b/allocation.yaml deleted file mode 100644 index 7da333e1..00000000 --- a/allocation.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2018 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: "allocation.agones.dev/v1" -kind: GameServerAllocation -spec: - required: - matchLabels: - agones.dev/fleet: dedicated diff --git a/build_protos.sh b/build_protos.sh deleted file mode 100644 index 70cc415e..00000000 --- a/build_protos.sh +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -echo "BUILDING PROTO FILES" - -mkdir output - -PROTOS=$(find mount -name '*.proto' -not -path "*/vendor/*") - -protoc ${PROTOS} -I mount/ -I /usr/include/ --go_out=output --go-grpc_out=output - -cp -r -f output/github.com/googleforgames/space-agon/* mount/ diff --git a/director.yaml b/director.yaml new file mode 100644 index 00000000..bd767a59 --- /dev/null +++ b/director.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: director +spec: + replicas: 1 + selector: + matchLabels: + run: director + template: + metadata: + labels: + run: director + spec: + containers: + - image: us-central1-docker.pkg.dev/qwiklabs-gcp-01-dae9145d7029/space-agon/space-agon-director:e189bf1 + imagePullPolicy: Always + name: director + serviceAccount: fleet-allocator + +--- + +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: fleet-allocator + name: fleet-allocator + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app: fleet-allocator + name: fleet-allocator +rules: +- apiGroups: + - "" + resources: + - events + verbs: + - create +- apiGroups: + - allocation.agones.dev + resources: + - gameserverallocations + verbs: + - create +- apiGroups: + - agones.dev + resources: + - fleets + verbs: + - get + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app: fleet-allocator + name: fleet-allocator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: fleet-allocator +subjects: +- kind: ServiceAccount + name: fleet-allocator diff --git a/fleet.yaml b/fleet.yaml new file mode 100644 index 00000000..4bee27b3 --- /dev/null +++ b/fleet.yaml @@ -0,0 +1 @@ +#TODO Fleet (container port 2156; 200Mi memory; 500m cpu; protocol TCP) \ No newline at end of file diff --git a/frontend.yaml b/frontend.yaml new file mode 100644 index 00000000..2d6afebb --- /dev/null +++ b/frontend.yaml @@ -0,0 +1,4 @@ +#TODO Deployment (container port 8080; protocol TCP; replicas 2) + +--- +#TODO Service (port 80, target port 8080, TCP, type LoadBalancer) \ No newline at end of file diff --git a/gameserver.yaml b/gameserver.yaml new file mode 100644 index 00000000..f2e43dad --- /dev/null +++ b/gameserver.yaml @@ -0,0 +1 @@ +#TODO GameServer(container port 2156; 200Mi memory; 500m cpu; protocol TCP) \ No newline at end of file diff --git a/mmf.yaml b/mmf.yaml new file mode 100644 index 00000000..8f0d0796 --- /dev/null +++ b/mmf.yaml @@ -0,0 +1,4 @@ +#TODO Deployment (replicas 2; container port 50502; protocol TCP; image pull policy Always) + +--- +#TODO Service (port 50502; protocol TCP) \ No newline at end of file