Skip to content

Commit 952012a

Browse files
[CI] Misc fixes
This makes a couple misc fixes needed for setting up the new cluster: * Added a node locations option for the service nodes so that they do not get replicated per zone in regional clusters. * Make the k8s secrets for the runner scale sets depend on the namespace resources so that we do not end up in an error caused by a race condition where TF tries to create the secrets in a nonexistent namespace. This is not actually enough to get the second cluster running. Trying to startup ARC causes failures as we are currently not specifying a runner group and the runner scale sets need to be placed under different runner groups.
1 parent 7af3b3d commit 952012a

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

premerge/gke_cluster/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ resource "google_container_cluster" "llvm_premerge" {
1515
}
1616

1717
resource "google_container_node_pool" "llvm_premerge_linux_service" {
18-
name = "llvm-premerge-linux-service"
19-
location = var.region
20-
cluster = google_container_cluster.llvm_premerge.name
21-
node_count = 3
18+
name = "llvm-premerge-linux-service"
19+
location = var.region
20+
cluster = google_container_cluster.llvm_premerge.name
21+
node_count = 3
22+
node_locations = var.service_node_pool_locations
2223

2324
node_config {
2425
machine_type = "e2-highcpu-4"

premerge/gke_cluster/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ variable "linux_machine_type" {
1616
variable "windows_machine_type" {
1717
description = "The type of machine to use for Windows instances"
1818
type = string
19-
}
19+
}
20+
21+
variable "service_node_pool_locations" {
22+
description = "The location to run the service node pool in"
23+
type = list(any)
24+
default = null
25+
}

premerge/main.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@ moved {
6161
to = module.premerge_cluster_us_central
6262
}
6363

64+
# We explicitly specify a single zone for the service node pool locations as
65+
# terraform by default will create node_count nodes per zone. We only want
66+
# node_count nodes rather than (node_count * zone count) nodes, so we
67+
# explicitly enumerate a specific region.
6468
module "premerge_cluster_us_west" {
65-
source = "./gke_cluster"
66-
cluster_name = "llvm-premerge-cluster-us-west"
67-
region = "us-west8"
68-
linux_machine_type = "n2d-standard-64"
69-
windows_machine_type = "n2d-standard-32"
69+
source = "./gke_cluster"
70+
cluster_name = "llvm-premerge-cluster-us-west"
71+
region = "us-west1"
72+
linux_machine_type = "n2d-standard-64"
73+
windows_machine_type = "n2d-standard-32"
74+
service_node_pool_locations = ["us-west1-a"]
7075
}
7176

7277
provider "helm" {

premerge/premerge_resources/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ resource "kubernetes_secret" "linux_github_pat" {
3636
}
3737

3838
type = "Opaque"
39+
40+
depends_on = [kubernetes_namespace.llvm_premerge_linux_runners]
3941
}
4042

4143
resource "kubernetes_namespace" "llvm_premerge_windows_runners" {
@@ -57,6 +59,8 @@ resource "kubernetes_secret" "windows_github_pat" {
5759
}
5860

5961
type = "Opaque"
62+
63+
depends_on = [kubernetes_namespace.llvm_premerge_windows_runners]
6064
}
6165

6266
resource "helm_release" "github_actions_runner_controller" {

0 commit comments

Comments
 (0)