diff --git a/.github/release/clusters/logos-storage-rel-tests-gcp-europe-west4/main.tf b/.github/release/clusters/logos-storage-rel-tests-gcp-europe-west4/main.tf index c280ac1b..294c2915 100644 --- a/.github/release/clusters/logos-storage-rel-tests-gcp-europe-west4/main.tf +++ b/.github/release/clusters/logos-storage-rel-tests-gcp-europe-west4/main.tf @@ -1,46 +1,30 @@ -# Kubernetes cluster — runners-ci pool is configured inline in the module +# Both node pools are inline in the module so GCP provisions them in parallel. module "gke" { source = "../modules/gke" - name = "logos-storage-rel-tests" - project = var.project - region = var.region - zone = var.zone - node_pool_name = "runners-ci-e2-standard-2" - node_pool_machine_type = "e2-standard-2" - node_pool_min = 1 - node_pool_max = 5 + name = "logos-storage-rel-tests" + project = var.project + region = var.region + zone = var.zone + + node_pool_name = "runners-ci-e2-standard-2" + node_pool_machine_type = "e2-standard-2" + node_pool_min = 1 + node_pool_max = 5 node_pool_labels = { allow-tests-pods = "false" default-pool = "true" scaling-type = "auto" workload-type = "tests-runners-ci" } -} -# Node pool - Tests Pods -resource "google_container_node_pool" "tests-pods" { - name = "tests-e2-medium" - cluster = module.gke.kubernetes_cluster_id - location = var.zone - project = var.project - - autoscaling { - min_node_count = 0 - max_node_count = 10 - } - - node_config { - machine_type = "e2-medium" - spot = true - labels = { - allow-tests-pods = "true" - default-pool = "false" - scaling-type = "auto" - workload-type = "tests-pods" - } - oauth_scopes = [ - "https://www.googleapis.com/auth/cloud-platform", - ] + tests_pool_name = "tests-e2-medium" + tests_pool_machine_type = "e2-medium" + tests_pool_max = 10 + tests_pool_labels = { + allow-tests-pods = "true" + default-pool = "false" + scaling-type = "auto" + workload-type = "tests-pods" } } diff --git a/.github/release/clusters/modules/gke/main.tf b/.github/release/clusters/modules/gke/main.tf index ba63ed0d..5c126bf9 100644 --- a/.github/release/clusters/modules/gke/main.tf +++ b/.github/release/clusters/modules/gke/main.tf @@ -1,5 +1,6 @@ -# Kubernetes cluster — runners-ci pool configured inline to avoid the -# remove_default_node_pool create-then-delete cycle that adds ~5 min. +# Both node pools are inline so GCP provisions them in parallel during +# cluster creation, avoiding the sequential create penalty of a separate +# google_container_node_pool resource. resource "google_container_cluster" "this" { name = local.name location = var.zone @@ -29,4 +30,24 @@ resource "google_container_cluster" "this" { ] } } + + node_pool { + name = var.tests_pool_name + initial_node_count = 0 + + autoscaling { + min_node_count = 0 + max_node_count = var.tests_pool_max + } + + node_config { + machine_type = var.tests_pool_machine_type + spot = true + labels = var.tests_pool_labels + + oauth_scopes = [ + "https://www.googleapis.com/auth/cloud-platform", + ] + } + } } diff --git a/.github/release/clusters/modules/gke/variables.tf b/.github/release/clusters/modules/gke/variables.tf index caf78c7f..d7b166df 100644 --- a/.github/release/clusters/modules/gke/variables.tf +++ b/.github/release/clusters/modules/gke/variables.tf @@ -48,3 +48,25 @@ variable "node_pool_labels" { scaling-type = "auto" } } + +# Tests node pool (spot, scales to zero) +variable "tests_pool_name" { + type = string + description = "Name for the tests node pool." +} + +variable "tests_pool_machine_type" { + type = string + description = "The GCE machine type for nodes in the tests pool." +} + +variable "tests_pool_max" { + type = number + description = "Maximum number of nodes in the tests pool." +} + +variable "tests_pool_labels" { + type = map(string) + description = "Kubernetes labels to apply to nodes in the tests pool." + default = {} +}