Skip to content

Commit

Permalink
Patching agones with kustomize (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
benfogel authored Feb 23, 2023
1 parent 06f4cdc commit 73433a5
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 224 deletions.
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,6 @@ Continue the promotion until Agones has been deployed to all clusters.

You can monitor the status of the deployment through the Cloud Logging URL returned by the `gcloud builds` command as well as the Kubernetes Engine/Worloads panel in the GCP Console. Once the Worloads have been marked as OK, you can proceed to apply the Allocation Endpoint Patch.

##### Allocation Endpoint Patch
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/platform/agones/endpoint-patch/
gcloud builds submit --config=cloudbuild.yaml
```

***NOTE*** - The cloudbuild.yaml, kustomization.yaml & skaffold.yaml files will not exist until Terraform runs for the first time! The templates used for these files are stored in `files/agones/`.

You can monitor the status of the deployment through the Cloud Logging URL returned by the `gcloud builds` comma
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 Services GKE Cluster

Replace the` _RELEASE_NAME` substitution with a unique build name. Cloudbuild will deploy Open Match using Cloud Deploy.
Expand Down
20 changes: 4 additions & 16 deletions infrastructure/allocation-endpoint.tf
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ resource "local_file" "agones-ae-lb-file" {

content = templatefile(
"${path.module}/files/agones/ae-lb-ip-patch.yaml.tpl", {
lb_ip = google_compute_address.allocation-endpoint[each.key].address
lb_ip = google_compute_address.allocation-endpoint[each.key].address
service_name = "${each.key}-${random_string.endpoint_random_string.result}.endpoints.${var.project}.cloud.goog"
sa_email = google_service_account.ae_sa.email
location = each.value.region
})
filename = "${path.module}/${var.platform_directory}/agones/install/${each.key}/kustomization.yaml"
}
Expand All @@ -228,18 +231,3 @@ resource "local_file" "agones-ns-file" {
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
resource "local_file" "patch-agones-manifest" {
for_each = var.game_gke_clusters

content = templatefile(
"${path.module}/files/agones/patch-agones-allocator.yaml.tpl", {
project_id = var.project
location = each.value.region
cluster_name = each.key
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}/${var.platform_directory}/agones/endpoint-patch/patch-agones-allocator-${each.key}.yaml"
}
80 changes: 72 additions & 8 deletions infrastructure/files/agones/ae-lb-ip-patch.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,77 @@ helmCharts:
namespace: agones-system
valuesInline:
agones:
allocator:
disableMTLS: true
disableTLS: true
service:
http:
enabled: false
loadBalancerIP: "${lb_ip}"
allocator:
disableMTLS: true
disableTLS: true
service:
serviceType: ClusterIP
http:
port: 443
targetPort: 9443
grpc:
enabled: false
loadBalancerIP: "${lb_ip}"

resources:
- agones-system.yaml
- agones-system.yaml

patches:
- target:
kind: Service
name: agones-allocator
patch: |-
apiVersion: v1
kind: Service
metadata:
name: agones-allocator
namespace: agones-system
spec:
ports:
- name: https
port: 443
targetPort: 9443
selector:
$patch: replace


- target:
kind: ServiceAccount
name: agones-allocator
patch: |-
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
iam.gke.io/gcp-service-account: ${sa_email}
name: agones-allocator
namespace: agones-system

- target:
kind: Deployment
name: agones-allocator
patch: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: agones-allocator
namespace: agones-system
spec:
template:
metadata:
labels:
istio.io/rev: asm-managed #ASM managed dataplane channel
region: ${location} #Region to identify the POD and send traffic
spec:
containers:
- args:
- --listener_port=9443
- --generate_self_signed_cert
- --backend=grpc://127.0.0.1:8443
- --service=${service_name}
- --rollout_strategy=managed
image: gcr.io/endpoints-release/endpoints-runtime:2
imagePullPolicy: IfNotPresent
name: esp
ports:
- containerPort: 9443
186 changes: 0 additions & 186 deletions infrastructure/files/agones/patch-agones-allocator.yaml.tpl

This file was deleted.

0 comments on commit 73433a5

Please sign in to comment.