Skip to content

Commit

Permalink
Agones Installation to Cloud Deploy Params (#260)
Browse files Browse the repository at this point in the history
This is the last piece of removing generating local files from the
Terraform configuration to use with Cloud Deploy - everything has now
been moved to Cloud Deploy Parameters!

This moves the installation of Agones' into each cluster to use a Cloud
Deploy parameter set on each Cloud Deploy Target.

This also simplifies the Skaffold configuration to remove Kustomize from
the yaml.

Closes #181
  • Loading branch information
markmandel authored May 23, 2024
1 parent 1a3e51a commit a0bec03
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 90 deletions.
11 changes: 0 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ backend.tf

deploy/base/charts/

# Ignore Terraform generated k8s manifest files
patch-agones-allocator-*.yaml

# Ignore Terraform generated skaffold files
skaffold-global-game-*.yaml
platform/agones/skaffold.yaml

# Ignore Terraform generated kustomization files
**/global-game-*/kustomization.yaml
**/global-game-*/agones-system.yaml

# Ignore any tmp files generated
infrastructure/tmp

Expand Down
29 changes: 0 additions & 29 deletions infrastructure/agones-gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,3 @@ resource "google_compute_firewall" "agones-gameservers" {
target_tags = ["game-server"]
source_ranges = ["0.0.0.0/0"]
}

# Make Skaffold file for Cloud Deploy into each GKE Cluster
resource "local_file" "agones-skaffold-file" {
content = templatefile(
"${path.module}/files/agones/skaffold.yaml.tpl", {
gke_clusters = merge(var.game_gke_standard_clusters, var.game_gke_autopilot_clusters)
})
filename = "${path.module}/${var.platform_directory}/agones/skaffold.yaml"
}

# Make cluster specific helm value for LB IP
resource "local_file" "agones-ae-lb-file" {
for_each = merge(var.game_gke_standard_clusters, var.game_gke_autopilot_clusters)

content = templatefile(
"${path.module}/files/agones/agones-install.yaml.tpl", {
location = each.value.region
})
filename = "${path.module}/${var.platform_directory}/agones/${each.key}/kustomization.yaml"
}

# Create agones-system ns manifest as resource referenced by kustomization.yaml
resource "local_file" "agones-ns-file" {
for_each = merge(var.game_gke_standard_clusters, var.game_gke_autopilot_clusters)

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

27 changes: 0 additions & 27 deletions infrastructure/files/agones/agones-install.yaml.tpl

This file was deleted.

22 changes: 0 additions & 22 deletions infrastructure/files/agones/skaffold.yaml.tpl

This file was deleted.

5 changes: 4 additions & 1 deletion infrastructure/pipelines.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ resource "google_clouddeploy_target" "agones-gke" {
project = var.project
require_approval = false

deploy_parameters = {
"agones.allocator.labels.region" = each.value.region
}

depends_on = [google_project_service.project]
}

Expand All @@ -115,7 +119,6 @@ resource "google_clouddeploy_delivery_pipeline" "agones-gke" {
for_each = merge(var.game_gke_standard_clusters, var.game_gke_autopilot_clusters)
content {
target_id = google_clouddeploy_target.agones-gke[stages.key].target_id
profiles = [stages.key]
}
}
}
Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions platform/agones/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2024 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: skaffold/v4beta9
kind: Config
manifests:
rawYaml:
- agones-system.yaml
helm:
releases:
- name: agones
namespace: agones-system
repo: https://agones.dev/chart/stable
remoteChart: agones
version: 1.40.0
setValues:
agones.crds.cleanupOnDelete: false
agones.allocator.disableMTLS: true
agones.allocator.disableTLS: true
agones.allocator.service.serviceType: ClusterIP
agones.allocator.service.http.port: 8000
agones.allocator.service.http.targetPort: 8000
agones.allocator.service.http.portName: http-alloc
agones.allocator.service.grpc.enabled: false
agones.allocator.labels.istio\.io/rev: asm-managed
# agones.allocator.labels.region: -- set by convention with Cloud Deploy Parameter attached to the target cluster
deploy:
kubectl:
flags:
apply:
- --server-side # Avoid the "Too long: must have at most 262144 bytes" problem
- --force-conflicts
tolerateFailuresUntilDeadline: true # Fixes startup timeouts

0 comments on commit a0bec03

Please sign in to comment.