-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Terraform template file for the performance test cluster (#3409)
- Loading branch information
Showing
4 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform init -backend-config="bucket=<YOUR_GCP_ProjectID>-performance-infra-bucket-tfstate" -backend-config="prefix=terraform/state" | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
// The performance test cluster is hosted in project `agones-e2e-1`, i.e: | ||
// terraform init -backend-config="bucket=agones-e2e-1-performance-infra-bucket-tfstate" -backend-config="prefix=terraform/state" | ||
// terraform apply -var project="agones-e2e-1" | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "~> 4.25.0" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "~> 2.3" | ||
} | ||
} | ||
backend "gcs" { | ||
} | ||
} | ||
|
||
variable "project" {} | ||
variable "kubernetes_versions" { | ||
description = "Create performance test clusters with these k8s versions in these regions" | ||
type = map(list(string)) | ||
default = { | ||
"1.26" = ["us-central1", "REGULAR"] | ||
} | ||
} | ||
|
||
module "gke_standard_cluster" { | ||
for_each = var.kubernetes_versions | ||
source = "../e2e/gke-standard" | ||
project = var.project | ||
kubernetesVersion = each.key | ||
location = each.value[0] | ||
overrideName = format("standard-performance-test-cluster-%s", replace(each.key, ".", "-")) | ||
releaseChannel = each.value[1] | ||
machineType = "n2-standard-2" | ||
initialNodeCount = 300 | ||
} | ||
|
||
resource "google_compute_firewall" "udp" { | ||
name = "gke-game-server-firewall" | ||
project = var.project | ||
network = "default" | ||
|
||
allow { | ||
protocol = "udp" | ||
ports = ["7000-8000"] | ||
} | ||
|
||
target_tags = ["game-server"] | ||
source_ranges = ["0.0.0.0/0"] | ||
} | ||
|
||
resource "google_compute_firewall" "tcp" { | ||
name = "gke-game-server-firewall-tcp" | ||
project = var.project | ||
network = "default" | ||
|
||
allow { | ||
protocol = "tcp" | ||
ports = ["7000-8000"] | ||
} | ||
|
||
target_tags = ["game-server"] | ||
source_ranges = ["0.0.0.0/0"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
|
||
// The performance test cluster is hosted in project `agones-e2e-1`, i.e: | ||
// terraform apply -var project="agones-e2e-1" | ||
|
||
// # GCS bucket for holding the Terraform state of the performance test Terraform config. | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "~> 4.25.0" | ||
} | ||
} | ||
} | ||
|
||
variable "project" {} | ||
|
||
resource "google_storage_bucket" "default" { | ||
project = var.project | ||
name = "${var.project}-performance-infra-bucket-tfstate" | ||
force_destroy = false | ||
uniform_bucket_level_access = true | ||
location = "US" | ||
storage_class = "STANDARD" | ||
versioning { | ||
enabled = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters