From 0a332dc336058a7fe1e146fe28e2cd5f52a88f07 Mon Sep 17 00:00:00 2001 From: Dmitry Beykun Date: Wed, 24 Jan 2024 11:14:14 +0900 Subject: [PATCH] GKE: support ephemeral_storage_local_ssd_config --- google/_modules/gke/node_pool/main.tf | 8 ++++++++ google/_modules/gke/node_pool/variables.tf | 8 ++++++++ google/cluster/node-pool/configuration.tf | 2 ++ google/cluster/node-pool/main.tf | 2 ++ google/cluster/node-pool/variables.tf | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/google/_modules/gke/node_pool/main.tf b/google/_modules/gke/node_pool/main.tf index 8fd80a59..0fd694b0 100644 --- a/google/_modules/gke/node_pool/main.tf +++ b/google/_modules/gke/node_pool/main.tf @@ -58,6 +58,14 @@ resource "google_container_node_pool" "current" { effect = taint.value["effect"] } } + + dynamic "ephemeral_storage_local_ssd_config" { + for_each = var.ephemeral_storage_local_ssd_config == null ? [] : [1] + + content { + local_ssd_count = var.ephemeral_storage_local_ssd_config.local_ssd_count + } + } } management { diff --git a/google/_modules/gke/node_pool/variables.tf b/google/_modules/gke/node_pool/variables.tf index 154bee34..a5dbf25c 100644 --- a/google/_modules/gke/node_pool/variables.tf +++ b/google/_modules/gke/node_pool/variables.tf @@ -138,3 +138,11 @@ variable "guest_accelerator" { description = "`guest_accelerator` block supports during node_group creation, useful to provision GPU-capable nodes. Default to `null` or `{}` which will disable GPUs." default = null } + +variable "ephemeral_storage_local_ssd_config" { + type = object({ + local_ssd_count = number + }) + description = "`ephemeral_storage_local_ssd_config` block, useful for node groups with local SSD. Defaults to `null`" + default = null +} diff --git a/google/cluster/node-pool/configuration.tf b/google/cluster/node-pool/configuration.tf index c12077dc..e7c3ced5 100644 --- a/google/cluster/node-pool/configuration.tf +++ b/google/cluster/node-pool/configuration.tf @@ -37,4 +37,6 @@ locals { node_workload_metadata_config = local.cfg["node_workload_metadata_config"] != null ? local.cfg["node_workload_metadata_config"] : "GKE_METADATA" service_account_email = local.cfg["service_account_email"] + + ephemeral_storage_local_ssd_config = local.cfg["ephemeral_storage_local_ssd_config"] } diff --git a/google/cluster/node-pool/main.tf b/google/cluster/node-pool/main.tf index 399eb1f1..0e1b46d7 100644 --- a/google/cluster/node-pool/main.tf +++ b/google/cluster/node-pool/main.tf @@ -34,4 +34,6 @@ module "node_pool" { service_account_email = local.service_account_email disable_per_node_pool_service_account = local.service_account_email == null ? false : true + + ephemeral_storage_local_ssd_config = local.ephemeral_storage_local_ssd_config } diff --git a/google/cluster/node-pool/variables.tf b/google/cluster/node-pool/variables.tf index 2dc62dea..5fe1d9f6 100644 --- a/google/cluster/node-pool/variables.tf +++ b/google/cluster/node-pool/variables.tf @@ -32,6 +32,10 @@ variable "configuration" { node_workload_metadata_config = optional(string) service_account_email = optional(string) + + ephemeral_storage_local_ssd_config = optional(object({ + local_ssd_count = number + })) })) description = "Map with per workspace cluster configuration." }