Skip to content

Commit 512443a

Browse files
[CI] Enable Workload Identity Federation on Linux/Windows Nodepools
This patch enables workload identity federation on the Linux and Windows node pools as described in https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity. This is necessary for authenticating with the GCS APIs so that we can use sccache with a GCS bucket for caching. Reviewers: cmtice, dschuff, lnihlen, Keenuts, gburgessiv Reviewed By: cmtice Pull Request: #506
1 parent 0b69fd6 commit 512443a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

premerge/gke_cluster/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ resource "google_container_cluster" "llvm_premerge" {
1212
# for adding windows nodes to the cluster.
1313
networking_mode = "VPC_NATIVE"
1414
ip_allocation_policy {}
15+
16+
# Set the workload identity config so that we can authenticate with Google
17+
# Cloud APIs using workload identity federation as described in
18+
# https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity.
19+
workload_identity_config {
20+
workload_pool = "llvm-premerge-checks.svc.id.goog"
21+
}
1522
}
1623

1724
resource "google_container_node_pool" "llvm_premerge_linux_service" {
@@ -62,6 +69,12 @@ resource "google_container_node_pool" "llvm_premerge_linux" {
6269
resource_labels = {
6370
"goog-gke-node-pool-provisioning-model" = "on-demand"
6471
}
72+
73+
# Enable workload identity federation for this pool so that we can access
74+
# GCS buckets.
75+
workload_metadata_config {
76+
mode = "GKE_METADATA"
77+
}
6578
}
6679
}
6780

@@ -139,6 +152,12 @@ resource "google_container_node_pool" "llvm_premerge_windows_2022" {
139152
resource_labels = {
140153
"goog-gke-node-pool-provisioning-model" = "on-demand"
141154
}
155+
156+
# Enable workload identity federation for this pool so that we can access
157+
# GCS buckets.
158+
workload_metadata_config {
159+
mode = "GKE_METADATA"
160+
}
142161
}
143162
}
144163

0 commit comments

Comments
 (0)