Skip to content

Commit

Permalink
Moved Open Match deploy into Services deploy directory (#71)
Browse files Browse the repository at this point in the history
* Moved Open Match deploy into Services deploy directory

* Moved Cloud Deploy files out of infrastructure/ & into services/

* Moved open-match & agones from services/ -> platform/
  • Loading branch information
abmarcum authored Feb 23, 2023
1 parent f564bd4 commit 06f4cdc
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 76 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The Agones deployment is in two steps: The Initial Install and the Allocation En
Replace the` _RELEASE_NAME` substitution with a unique build name. Cloudbuild will deploy Agones using Cloud Deploy.

```shell
cd $GAME_DEMO_HOME/infrastructure/deploy/agones/install
cd $GAME_DEMO_HOME/platform/agones/install
gcloud builds submit --config=cloudbuild.yaml --substitutions=_RELEASE_NAME=rel-1
```

Expand All @@ -84,7 +84,7 @@ You can monitor the status of the deployment through the Cloud Logging URL retur
After the Agones install has completed and the GKE Workloads show complete, run the Allocation Endpoint Patch Cloud Deploy to apply the appropriate endpoint patches to each cluster:

```shell
cd $GAME_DEMO_HOME/infrastructure/deploy/agones/endpoint-patch/
cd $GAME_DEMO_HOME/platform/agones/endpoint-patch/
gcloud builds submit --config=cloudbuild.yaml
```

Expand All @@ -94,12 +94,12 @@ You can monitor the status of the deployment through the Cloud Logging URL retur
nd as well as the Kubernetes Engine/Worloads panel in the GCP Console. Once the Worloads have been marked as O
K, Agones should be avaialable.

#### Deploy Open Match to Game Services GKE Cluster
#### Deploy Open Match to Services GKE Cluster

Replace the` _RELEASE_NAME` substitution with a unique build name. Cloudbuild will deploy Open Match using Cloud Deploy.

```shell
cd $GAME_DEMO_HOME/infrastructure/deploy/open-match
cd $GAME_DEMO_HOME/platform/open-match/
gcloud builds submit --config=cloudbuild.yaml --substitutions=_RELEASE_NAME=rel-1
```

Expand Down
10 changes: 5 additions & 5 deletions infrastructure/allocation-endpoint.tf
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ resource "local_file" "agones-skaffold-file" {
"${path.module}/files/agones/skaffold.yaml.tpl", {
gke_clusters = var.game_gke_clusters
})
filename = "${path.module}/deploy/agones/install/skaffold.yaml"
filename = "${path.module}/${var.platform_directory}/agones/install/skaffold.yaml"
}

# Make cluster specific helm value for LB IP
Expand All @@ -218,15 +218,15 @@ resource "local_file" "agones-ae-lb-file" {
"${path.module}/files/agones/ae-lb-ip-patch.yaml.tpl", {
lb_ip = google_compute_address.allocation-endpoint[each.key].address
})
filename = "${path.module}/deploy/agones/install/${each.key}/kustomization.yaml"
filename = "${path.module}/${var.platform_directory}/agones/install/${each.key}/kustomization.yaml"
}

# Create agones-system ns manifest as resource referenced by kustomization.yaml
resource "local_file" "agones-ns-file" {
for_each = var.game_gke_clusters

content = file("${path.module}/files/agones/agones-system.yaml")
filename = "${path.module}/deploy/agones/install/${each.key}/agones-system.yaml"
content = file("${path.module}/files/agones/agones-system.yaml")
filename = "${path.module}/${var.platform_directory}/agones/install/${each.key}/agones-system.yaml"
}

# Make Kubernetes manifest files to patch the Agones deployment for Allocation Endpoint
Expand All @@ -241,5 +241,5 @@ resource "local_file" "patch-agones-manifest" {
service_name = "${each.key}-${random_string.endpoint_random_string.result}.endpoints.${var.project}.cloud.goog"
sa_email = google_service_account.ae_sa.email
})
filename = "${path.module}/deploy/agones/endpoint-patch/patch-agones-allocator-${each.key}.yaml"
filename = "${path.module}/${var.platform_directory}/agones/endpoint-patch/patch-agones-allocator-${each.key}.yaml"
}
3 changes: 0 additions & 3 deletions infrastructure/deploy/open-match/kustomization.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions infrastructure/deploy/open-match/skaffold.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions infrastructure/deploy/services/install/cloudbuild.yaml

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions infrastructure/deploy/services/install/spanner-system.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions infrastructure/pipelines.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ resource "google_clouddeploy_target" "agones" {
for_each = var.game_gke_clusters

location = var.clouddeploy_config.location
name = "agones-deploy-target-${each.key}"
name = "${each.value.short_name}-agones-deploy"


annotations = {
my_first_annotation = "agones-annotation-1"
Expand Down Expand Up @@ -101,7 +102,7 @@ resource "google_clouddeploy_delivery_pipeline" "agones" {
for_each = var.game_gke_clusters
content {
target_id = google_clouddeploy_target.agones[stages.key].target_id
profiles = [stages.key]
profiles = [stages.key]
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions infrastructure/terraform.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Project Specific Variables
project = "PROJECT_ID"

# Cloud Deploy Configuration
platform_directory = "../platform" # Relative to Terraform directory
clouddeploy_config = {
"location" : "us-central1"
}
Expand All @@ -40,18 +42,32 @@ vpc_regions = {
### `agones/install` & `deploy/agones/endpoint-patch/` as they are not dynamically created.
game_gke_clusters = {
"global-game-us-central1-01" : {
"short_name" : "us-central1-01",
"region" : "us-central1",
"machine_type" : "e2-standard-4"
},
"global-game-us-central1-02" : {
"short_name" : "us-central1-02",
"region" : "us-central1",
"machine_type" : "e2-standard-4"
},
"global-game-eu-west1-01" : {
"short_name" : "europe-west1-01",
"region" : "europe-west1",
"machine_type" : "e2-standard-4"
},
"global-game-eu-west1-02" : {
"short_name" : "europe-west1-02",
"region" : "europe-west1",
"machine_type" : "e2-standard-4"
},
"global-game-asia-east1-01" : {
"short_name" : "asia-east1-01",
"region" : "asia-east1",
"machine_type" : "e2-standard-4"
},
"global-game-asia-east1-02" : {
"short_name" : "asia-east1-02",
"region" : "asia-east1",
"machine_type" : "e2-standard-4"
}
Expand Down
7 changes: 7 additions & 0 deletions infrastructure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ variable "spanner_config" {
description = "Configuration specs for Spanner"
}

### Services GKE Variables ###

variable "services_gke_config" {
type = object({
cluster_name = string
Expand Down Expand Up @@ -100,3 +102,8 @@ variable "allocation_endpoint" {
})
description = "Allocation Endpoint Configuration Variables"
}

variable "platform_directory" {
type = string
description = "Services Directory for outputed Cloud Deploy related files"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ steps:
- --cluster=global-game-asia-east1-01
- --output=output/agones-patch-asia-east1-01

- name: "gcr.io/cloud-builders/gke-deploy"
args:
- run
- --filename=patch-agones-allocator-global-game-asia-east1-02.yaml
- --location=asia-east1
- --cluster=global-game-asia-east1-02
- --output=output/agones-patch-asia-east1-02

- name: "gcr.io/cloud-builders/gke-deploy"
args:
- run
Expand All @@ -30,6 +38,14 @@ steps:
- --cluster=global-game-eu-west1-01
- --output=output/agones-patch-europe-west1-01

- name: "gcr.io/cloud-builders/gke-deploy"
args:
- run
- --filename=patch-agones-allocator-global-game-eu-west1-02.yaml
- --location=europe-west1
- --cluster=global-game-eu-west1-02
- --output=output/agones-patch-europe-west1-02

- name: "gcr.io/cloud-builders/gke-deploy"
args:
- run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
entrypoint: gcloud
args:
[
"deploy", "releases", "create", "${_RELEASE_NAME}",
"deploy", "releases", "create", "agones-${_RELEASE_NAME}",
"--delivery-pipeline", "agones-deploy-pipeline",
"--skaffold-file", "skaffold.yaml",
"--skaffold-version", "1.39",
Expand Down
40 changes: 40 additions & 0 deletions platform/agones/install/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: skaffold/v2beta29
kind: Config
deploy:
kustomize:
paths:
- "./path_to_cluster_specific_skaffold"
buildArgs: ["--enable-helm"]
flags:
apply: ['--server-side'] # Avoid the "Too long: must have at most 262144 bytes" problem
profiles:
- name: global-game-asia-east1-01
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-asia-east1-01"
- name: global-game-asia-east1-02
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-asia-east1-02"
- name: global-game-eu-west1-01
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-eu-west1-01"
- name: global-game-eu-west1-02
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-eu-west1-02"
- name: global-game-us-central1-01
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-us-central1-01"
- name: global-game-us-central1-02
patches:
- op: replace
path: /deploy/kustomize/paths/0
value: "./global-game-us-central1-02"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ./base/kustomization.yaml
helmCharts:
- name: open-match
namespace: open-match
repo: https://open-match.dev/chart/stable
version: 1.6.0
releaseName: open-match
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ steps:
entrypoint: gcloud
args:
[
"deploy", "releases", "create", "${_RELEASE_NAME}",
"deploy", "releases", "create", "open-match-${_RELEASE_NAME}",
"--delivery-pipeline", "global-game-open-match",
"--skaffold-file", "skaffold.yaml",
"--skaffold-version", "1.39",
"--region", "us-central1"
]

substitutions:
_RELEASE_NAME: rel-0002
_RELEASE_NAME: rel-0001
options:
logging: CLOUD_LOGGING_ONLY
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Config
deploy:
kustomize:
paths:
- "./nginx"
- "./base"
buildArgs: ["--enable-helm"]
flags:
apply: ['--server-side'] # Avoid the "Too long: must have at most 262144 bytes" problem

0 comments on commit 06f4cdc

Please sign in to comment.