Skip to content

Commit 4f5a16b

Browse files
committed
feat: add node pool guest accelerator configuration
1 parent 8081483 commit 4f5a16b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,23 @@ resource "google_container_node_pool" "pools" {
131131
spot = lookup(each.value, "spot", false)
132132
labels = lookup(var.node_pools_labels, each.value["name"], {})
133133
oauth_scopes = lookup(local.node_pool_oauth_scopes, each.value["name"], [])
134+
135+
dynamic "guest_accelerator" {
136+
for_each = lookup(each.value, "guest_accelerator", null) != null ? [1] : []
137+
content {
138+
type = lookup(each.value["guest_accelerator"], "type", "")
139+
count = lookup(each.value["guest_accelerator"], "count", 0)
140+
gpu_partition_size = lookup(each.value["guest_accelerator"], "gpu_partition_size", null)
141+
142+
dynamic "gpu_sharing_config" {
143+
for_each = lookup(each.value["guest_accelerator"], "gpu_sharing_config", null) != null ? [1] : []
144+
content {
145+
gpu_sharing_strategy = lookup(gpu_sharing_config.value, "gpu_sharing_strategy", "TIME_SHARING")
146+
max_shared_clients_per_gpu = lookup(gpu_sharing_config.value, "max_shared_clients_per_gpu", 2)
147+
}
148+
}
149+
}
150+
}
134151
}
135152
lifecycle {
136153
ignore_changes = [initial_node_count]

variables.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ variable "zones" {
5555
description = "List of zones for `zonal` cluster. Required if `regional` set to `false`."
5656
}
5757
variable "node_pools" {
58-
type = list(map(string))
58+
type = list(any)
5959
default = [
6060
{
6161
name = "default-node-pool"
@@ -139,9 +139,11 @@ variable "additional_node_pool_oauth_scopes" {
139139
variable "default_node_pools_oauth_scopes" {
140140
type = list(string)
141141
default = [
142+
"https://www.googleapis.com/auth/devstorage.read_only",
142143
"https://www.googleapis.com/auth/cloud-platform",
143144
"https://www.googleapis.com/auth/logging.write",
144-
"https://www.googleapis.com/auth/monitoring"
145+
"https://www.googleapis.com/auth/monitoring",
146+
"https://www.googleapis.com/auth/compute"
145147
]
146148
description = "Default node pool oauth scopes added to all node pools"
147149
}

0 commit comments

Comments
 (0)