Skip to content

Commit

Permalink
Move Platform/Open Match to Cloud Deploy Params (#257)
Browse files Browse the repository at this point in the history
This was a fun one as we have a Helm chart in play, and that was
non-obvious in terms of how to integrate:

* Remove `kustomize` render, since we don't need it anymore.
* Create Cloud Parameters that match the Helm configuration variables
  that we need to match in the Helm configuration.
* Also moved cloudbuild.yaml to `script:`

Next is the Agones deployments!

Work on #181
  • Loading branch information
markmandel authored Apr 24, 2024
1 parent 4b0b3e8 commit ea29f54
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 92 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ platform/agones/skaffold.yaml
# Ignore Terraform generated kustomization files
**/global-game-*/kustomization.yaml
**/global-game-*/agones-system.yaml
platform/open-match/base/kustomization.yaml

# Ignore any tmp files generated
infrastructure/tmp
Expand Down
50 changes: 0 additions & 50 deletions infrastructure/files/open-match/kustomization.yaml.tpl

This file was deleted.

10 changes: 0 additions & 10 deletions infrastructure/open-match.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,3 @@ resource "google_service_networking_connection" "private_service_connection" {
depends_on = [google_project_service.project]
}

# Add Redis Host & IP to Open Match kustomization.yaml
resource "local_file" "open-match-kustomization-file" {

content = templatefile(
"${path.module}/files/open-match/kustomization.yaml.tpl", {
redis_host = google_redis_instance.open-match.host
redis_port = google_redis_instance.open-match.port
})
filename = "${path.module}/${var.platform_directory}/open-match/base/kustomization.yaml"
}
7 changes: 7 additions & 0 deletions infrastructure/pipelines.tf
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ resource "google_clouddeploy_delivery_pipeline" "open-match" {
serial_pipeline {
stages {
target_id = google_clouddeploy_target.open-match-target.target_id
deploy_parameters {
values = {
# values are passed into Cloud Deploy Helm Charts by convention.
"open-match-core.redis.hostname" = google_redis_instance.open-match.host
"open-match-core.redis.port" = google_redis_instance.open-match.port
}
}
}
}
}
Expand Down
43 changes: 18 additions & 25 deletions platform/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,34 @@ steps:
# newly added clusters are configured properly with ASM.
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
id: fleet-membership
entrypoint: bash
args:
- '-c'
- |
MEMBERSHIPS=$(gcloud container fleet memberships list --format="value(name)" | xargs | sed 's/ /,/g')
gcloud container fleet mesh update --management automatic --memberships $$MEMBERSHIPS
script: |
export MEMBERSHIPS=$(gcloud container fleet memberships list --format="value(name)" | xargs | sed 's/ /,/g') && \
echo Memberships: $MEMBERSHIPS && \
gcloud container fleet mesh update --management automatic --memberships "$MEMBERSHIPS"
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
id: deploy-agones
entrypoint: bash
dir: agones
args:
- '-c'
- |
gcloud deploy releases create deploy-$(date +'%Y%m%d%H%M%S') \
--annotations=cloud_build=https://console.cloud.google.com/cloud-build/builds/${BUILD_ID} \
--delivery-pipeline agones-deploy-pipeline \
--skaffold-file skaffold.yaml \
--region us-central1
script: |
gcloud deploy releases create deploy-$(date +'%Y%m%d%H%M%S') \
--annotations=cloud_build=https://console.cloud.google.com/cloud-build/builds/$BUILD_ID \
--delivery-pipeline agones-deploy-pipeline \
--skaffold-file skaffold.yaml \
--region us-central1
automapSubstitutions: true
waitFor:
- fleet-membership

- name: gcr.io/google.com/cloudsdktool/cloud-sdk
id: deploy-open-match
entrypoint: bash
dir: open-match
args:
- '-c'
- |
gcloud deploy releases create deploy-$(date +'%Y%m%d%H%M%S') \
--annotations=cloud_build=https://console.cloud.google.com/cloud-build/builds/${BUILD_ID} \
--delivery-pipeline global-game-open-match \
--skaffold-file skaffold.yaml \
--region us-central1
script: |
gcloud deploy releases create deploy-$(date +'%Y%m%d%H%M%S') \
--annotations=cloud_build=https://console.cloud.google.com/cloud-build/builds/$BUILD_ID \
--delivery-pipeline global-game-open-match \
--skaffold-file skaffold.yaml \
--region us-central1
automapSubstitutions: true
waitFor:
- fleet-membership

Expand Down
File renamed without changes.
32 changes: 26 additions & 6 deletions platform/open-match/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: skaffold/v4beta1
apiVersion: skaffold/v4beta9
kind: Config
manifests:
kustomize:
paths:
- ./base
buildArgs:
- --enable-helm
rawYaml:
- open-match.yaml
- agones-allocator-vs.yaml
helm:
releases:
- name: open-match
namespace: open-match
repo: https://open-match.dev/chart/stable
remoteChart: open-match
version: 1.8.0
setValues:
prometheus.enabled: false
grafana.enabled: false
jaeger.enabled: false
open-match-override.enabled: true
open-match-customize.enabled: true
open-match-customize.evaluator.enabled: true
open-match-core.redis.enabled: false
# open-match-core.redis.hostname: redis -- set through Cloud Deploy by convention
# open-match-core.redis.port: 6379 -- set through Cloud Deploy by convention
open-match-core.redis.pool.maxIdle: 500
open-match-core.redis.pool.maxActive: 500
open-match-core.redis.pool.idleTimeout: 0
open-match-core.redis.pool.healthCheckTimeout: 300ms

deploy:
kubectl:
flags:
Expand Down

0 comments on commit ea29f54

Please sign in to comment.