Skip to content

Commit f573a72

Browse files
[CI] Add Windows Server 2022 Node Pools
This patch configures the windows server 2022 node pools and runner sets for the transition from server 2019 to 2022. Reviewers: cmtice, Keenuts, dschuff, gburgessiv, lnihlen Reviewed By: cmtice Pull Request: #498
1 parent c925b9a commit f573a72

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

premerge/gke_cluster/main.tf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ resource "google_container_node_pool" "llvm_premerge_libcxx" {
9797
}
9898
}
9999

100+
# TODO(boomanaiden154): Make sure to delete this node pool after we have
101+
# switched over to server 2022.
100102
resource "google_container_node_pool" "llvm_premerge_windows" {
101103
name = "llvm-premerge-windows"
102104
location = var.region
@@ -138,3 +140,50 @@ resource "google_container_node_pool" "llvm_premerge_windows" {
138140
}
139141
}
140142
}
143+
144+
resource "google_container_node_pool" "llvm_premerge_windows_2022" {
145+
name = "llvm-premerge-windows-2022"
146+
location = var.region
147+
cluster = google_container_cluster.llvm_premerge.name
148+
initial_node_count = 0
149+
150+
# TODO(boomanaiden154): Bump this to full capacity (16 nodes) once we are
151+
# ready to switch over to server 2022.
152+
autoscaling {
153+
total_min_node_count = 0
154+
total_max_node_count = 2
155+
}
156+
157+
# We do not set a taint for the windows nodes as kubernetes by default sets
158+
# a node.kubernetes.io/os taint for windows nodes.
159+
node_config {
160+
machine_type = var.windows_machine_type
161+
labels = {
162+
"premerge-platform" : "windows-2022"
163+
}
164+
image_type = "WINDOWS_LTSC_CONTAINERD"
165+
windows_node_config {
166+
osversion = "OS_VERSION_LTSC2022"
167+
}
168+
# Add a script that runs on the initial boot to disable Windows Defender.
169+
# Windows Defender causes an increase in test times by approximately an
170+
# order of magnitude.
171+
metadata = {
172+
"sysprep-specialize-script-ps1" = "Set-MpPreference -DisableRealtimeMonitoring $true"
173+
# Terraform wants to recreate the node pool everytime whe running
174+
# terraform apply unless we explicitly set this.
175+
# TODO(boomanaiden154): Look into why terraform is doing this so we do
176+
# not need this hack.
177+
"disable-legacy-endpoints" = "true"
178+
}
179+
disk_size_gb = 200
180+
disk_type = "pd-ssd"
181+
# Terraform wants to recreate the node pool everytime whe running
182+
# terraform apply unless we explicitly set this.
183+
# TODO(boomanaiden154): Look into why terraform is doing this so we do
184+
# not need this hack.
185+
resource_labels = {
186+
"goog-gke-node-pool-provisioning-model" = "on-demand"
187+
}
188+
}
189+
}

premerge/premerge_resources/main.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ resource "kubernetes_namespace" "llvm_premerge_windows_runners" {
4747
}
4848
}
4949

50+
resource "kubernetes_namespace" "llvm_premerge_windows_2022_runners" {
51+
metadata {
52+
name = "llvm-premerge-windows-2022-runners"
53+
}
54+
}
55+
5056
resource "kubernetes_secret" "linux_github_pat" {
5157
metadata {
5258
name = "github-token"
@@ -132,6 +138,23 @@ resource "kubernetes_secret" "windows_github_pat" {
132138
depends_on = [kubernetes_namespace.llvm_premerge_windows_runners]
133139
}
134140

141+
resource "kubernetes_secret" "windows_2022_github_pat" {
142+
metadata {
143+
name = "github-token"
144+
namespace = "llvm-premerge-windows-2022-runners"
145+
}
146+
147+
data = {
148+
"github_app_id" = var.github_app_id
149+
"github_app_installation_id" = var.github_app_installation_id
150+
"github_app_private_key" = var.github_app_private_key
151+
}
152+
153+
type = "Opaque"
154+
155+
depends_on = [kubernetes_namespace.llvm_premerge_windows_2022_runners]
156+
}
157+
135158
resource "helm_release" "github_actions_runner_controller" {
136159
name = "llvm-premerge-controller"
137160
namespace = "llvm-premerge-controller"
@@ -180,6 +203,24 @@ resource "helm_release" "github_actions_runner_set_windows" {
180203
]
181204
}
182205

206+
resource "helm_release" "github_actions_runner_set_windows_2022" {
207+
name = "llvm-premerge-windows-2022-runners"
208+
namespace = "llvm-premerge-windows-2022-runners"
209+
repository = "oci://ghcr.io/actions/actions-runner-controller-charts"
210+
version = "0.11.0"
211+
chart = "gha-runner-scale-set"
212+
213+
values = [
214+
"${templatefile("windows_2022_runner_values.yaml", { runner_group_name : var.runner_group_name })}"
215+
]
216+
217+
depends_on = [
218+
kubernetes_namespace.llvm_premerge_windows_2022_runners,
219+
kubernetes_secret.windows_2022_github_pat,
220+
helm_release.github_actions_runner_controller,
221+
]
222+
}
223+
183224
resource "helm_release" "github_actions_runner_set_libcxx" {
184225
name = "llvm-premerge-libcxx-runners"
185226
namespace = "llvm-premerge-libcxx-runners"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
githubConfigUrl: "https://github.com/llvm"
2+
githubConfigSecret: "github-token"
3+
4+
minRunners: 0
5+
maxRunners: 16
6+
7+
runnerGroup: ${ runner_group_name }
8+
9+
template:
10+
metadata:
11+
annotations:
12+
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
13+
spec:
14+
tolerations:
15+
- key: "node.kubernetes.io/os"
16+
operator: "Equal"
17+
value: "windows"
18+
effect: "NoSchedule"
19+
- key: "premerge-platform"
20+
operator: "Equal"
21+
value: "windows-2022"
22+
effect: "NoSchedule"
23+
nodeSelector:
24+
premerge-platform: windows-2022
25+
containers:
26+
- name: runner
27+
resources:
28+
requests:
29+
cpu: 28
30+
image: ghcr.io/llvm/ci-windows-2022:latest
31+
command: ["run.cmd"]
32+
args: ["--jitconfig", "$(ACTIONS_RUNNER_INPUT_JITCONFIG)"]
33+
env:
34+
- name: DISABLE_RUNNER_UPDATE
35+
value: "true"
36+
# Add a volume/mount it to C:/_work so that we can use more than 20GB
37+
# of space. Windows containers default to only having 20GB of scratch
38+
# space and there is no way to configure this through kubernetes
39+
# although the underlying containerd runtime should support it. So
40+
# instead we just use a emptyDir volume mounted at C:/_work, which is
41+
# where the GHA runner does everything.
42+
volumeMounts:
43+
- name: builddir
44+
mountPath: "C:/_work"
45+
volumes:
46+
- name: builddir
47+
emptyDir: {}
48+

0 commit comments

Comments
 (0)