-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into AddGameServerStateDurationToGrafana
- Loading branch information
Showing
32 changed files
with
862 additions
and
413 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
*.iml | ||
bin | ||
*.o | ||
*.sln | ||
tmp | ||
terraform.tfvars | ||
terraform.tfstate* | ||
|
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 |
---|---|---|
|
@@ -50,4 +50,4 @@ module "gke_cluster" { | |
} | ||
|
||
udpFirewall = false // firewall is created at the project module level | ||
} | ||
} |
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 |
---|---|---|
|
@@ -64,4 +64,4 @@ module "gke_cluster" { | |
} | ||
|
||
udpFirewall = false // firewall is created at the project module level | ||
} | ||
} |
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,53 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "~> 4.25.0" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "~> 2.3" | ||
} | ||
} | ||
} | ||
|
||
variable "project" {} | ||
variable "kubernetesVersion" {} | ||
variable "location" {} | ||
variable "releaseChannel" {} | ||
|
||
module "gke_cluster" { | ||
source = "../../../../install/terraform/modules/gke-autopilot" | ||
|
||
cluster = { | ||
"name" = format("gke-autopilot-upgrade-test-cluster-%s", replace(var.kubernetesVersion, ".", "-")) | ||
"project" = var.project | ||
"location" = var.location | ||
"releaseChannel" = var.releaseChannel | ||
"kubernetesVersion" = var.kubernetesVersion | ||
"deletionProtection" = false | ||
"maintenanceExclusionStartTime" = timestamp() | ||
"maintenanceExclusionEndTime" = timeadd(timestamp(), "2640h") # 110 days | ||
} | ||
|
||
udpFirewall = false // firewall is created at the project module level | ||
} |
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,67 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "~> 4.25.0" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "~> 2.3" | ||
} | ||
} | ||
} | ||
|
||
variable "project" {} | ||
variable "kubernetesVersion" {} | ||
variable "location" {} | ||
variable "releaseChannel" {} | ||
|
||
variable "machineType" { | ||
default = "e2-standard-4" | ||
} | ||
|
||
variable "initialNodeCount" { | ||
default = 4 | ||
} | ||
|
||
variable "overrideName" { | ||
default = "" | ||
} | ||
|
||
module "gke_cluster" { | ||
source = "../../../../install/terraform/modules/gke" | ||
|
||
cluster = { | ||
"name" = var.overrideName != "" ? var.overrideName : format("standard-upgrade-test-cluster-%s", replace(var.kubernetesVersion, ".", "-")) | ||
"location" = var.location | ||
"releaseChannel" = var.releaseChannel | ||
"machineType" = var.machineType | ||
"initialNodeCount" = var.initialNodeCount | ||
"enableImageStreaming" = true | ||
"project" = var.project | ||
"kubernetesVersion" = var.kubernetesVersion | ||
"maintenanceExclusionStartTime" = timestamp() | ||
"maintenanceExclusionEndTime" = timeadd(timestamp(), "2640h") # 110 days | ||
} | ||
|
||
udpFirewall = false // firewall is created at the project module level | ||
} |
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,109 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform init -backend-config="bucket=<YOUR_GCP_ProjectID>-upgrade-infra-bucket-tfstate" -backend-config="prefix=terraform/state" | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
|
||
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 upgrade test clusters with these k8s versions in these regions" | ||
type = map(list(string)) | ||
default = { | ||
"1.28" = ["us-west1", "RAPID"] | ||
"1.29" = ["europe-west1", "RAPID"] | ||
"1.30" = ["asia-east1", "RAPID"] | ||
// "1.31" = ["us-east1", "RAPID"] | ||
// | ||
// Before merge: When adding Kubernetes version 1.{N}, first uncomment the line above, extending | ||
// the infrastructure to 4 versions temporarily. Come back to these instructions after the | ||
// update PR merges. | ||
// | ||
// After merge: After the Kubernetes update PR merges, and all active PRs are updated: | ||
// | ||
// * Move the 1.{N-3} line to the bottom and comment it out | ||
// * Change the (commented out) 1.{N-3} to 1.{N+1} | ||
// * You should now have 3 versions uncommented (versions 1.{N-2} .. 1.{N}), | ||
// and 1.{N+1} commented out for the next update. The new, commented out 1.{N+1} | ||
// should be using the region of the previous 1.{N-3} - this region will become | ||
// unused. | ||
// | ||
// Rationale: We cycle the regions us-east1 -> us-west1 -> europe-west1 -> asia-east1 -> us-east1 | ||
// as versions are added, using 4 regions so that the PR adding 1.{N} is in a unique region to | ||
// 1.{N-3} .. 1.{N-1}, meaning versions never need to share a region in CI. | ||
} | ||
} | ||
|
||
module "gke_standard_cluster" { | ||
for_each = var.kubernetes_versions | ||
source = "./gke-standard" | ||
project = var.project | ||
kubernetesVersion = each.key | ||
location = each.value[0] | ||
releaseChannel = each.value[1] | ||
} | ||
|
||
module "gke_autopilot_cluster" { | ||
for_each = var.kubernetes_versions | ||
source = "./gke-autopilot" | ||
project = var.project | ||
kubernetesVersion = each.key | ||
location = each.value[0] | ||
releaseChannel = each.value[1] | ||
} | ||
|
||
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,43 @@ | ||
// 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. | ||
|
||
|
||
// Run: | ||
// terraform apply -var project="<YOUR_GCP_ProjectID>" | ||
|
||
// GCS bucket for holding the Terraform state of the upgrade 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}-upgrade-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
Oops, something went wrong.