Skip to content

Commit

Permalink
Moved Redis from open-match helm chart provided to Cloud Memorystore (#…
Browse files Browse the repository at this point in the history
…97)

* Moved Redis from open-match helm chart to Cloud Memorystore

* Added ref to TLS mode in open-match Redis

* Added license info
  • Loading branch information
abmarcum authored Mar 2, 2023
1 parent 88cf437 commit 502c56f
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 17 deletions.
43 changes: 43 additions & 0 deletions infrastructure/files/open-match/kustomization.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2023 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.

# ./base/kustomization.yaml
helmCharts:
- name: open-match
namespace: open-match
repo: https://open-match.dev/chart/stable
version: 1.6.0
releaseName: open-match
valuesInline:
open-match-override:
enabled: true
open-match-customize:
enabled: true
evaluator:
enabled: true
open-match-core:
redis:
enabled: false
# If open-match-core.redis.enabled is set to false, have Open Match components talk to this redis address instead.
# Otherwise the default is set to the om-redis instance.
hostname: ${redis_host}
port: ${redis_port}
pool:
maxIdle: 500
maxActive: 500
idleTimeout: 0
healthCheckTimeout: 300ms

resources:
- open-match.yaml
70 changes: 70 additions & 0 deletions infrastructure/open-match.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2023 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
//
// https://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.


data "google_compute_network" "vpc" {
name = var.vpc_name
}

resource "google_redis_instance" "open-match" {
name = "global-game-open-match"
tier = "STANDARD_HA"
memory_size_gb = 1
region = var.services_gke_config.location

location_id = "${var.services_gke_config.location}-a"
alternative_location_id = "${var.services_gke_config.location}-f"

authorized_network = data.google_compute_network.vpc.id
transit_encryption_mode = "DISABLED"
connect_mode = "PRIVATE_SERVICE_ACCESS"

redis_version = "REDIS_6_X"
display_name = "Global Game Demo: Open Match"

labels = {
"environment" = var.resource_env_label
}

depends_on = [google_service_networking_connection.private_service_connection, google_project_service.project, google_container_cluster.services-gke]
}

resource "google_compute_global_address" "private_service_range" {
name = "private-service-range"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = data.google_compute_network.vpc.id

depends_on = [google_project_service.project]
}

resource "google_service_networking_connection" "private_service_connection" {
network = data.google_compute_network.vpc.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_service_range.name]

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"
}
2 changes: 2 additions & 0 deletions infrastructure/terraform.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ gcp_project_services = [
"artifactregistry.googleapis.com",
"spanner.googleapis.com",
"secretmanager.googleapis.com",
"servicenetworking.googleapis.com",
"servicecontrol.googleapis.com",
"redis.googleapis.com",
"run.googleapis.com",
"iap.googleapis.com"
]
Expand Down
17 changes: 0 additions & 17 deletions platform/open-match/base/kustomization.yaml

This file was deleted.

0 comments on commit 502c56f

Please sign in to comment.