From 9d9cb7f0072fe97735ecf9253718fb245929163b Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Thu, 2 Jan 2025 15:41:54 -0500 Subject: [PATCH 1/2] support setting hugepages config Signed-off-by: drfaust92 --- README.md | 2 ++ autogen/main/cluster.tf.tmpl | 19 +++++++++++++++- autogen/main/variables.tf.tmpl | 22 +++++++++++++++++++ autogen/main/variables_defaults.tf.tmpl | 20 +++++++++++++++++ cluster.tf | 19 +++++++++++++++- examples/node_pool/main.tf | 10 +++++++++ .../README.md | 2 ++ .../cluster.tf | 19 +++++++++++++++- .../variables.tf | 22 +++++++++++++++++++ .../variables_defaults.tf | 20 +++++++++++++++++ modules/beta-private-cluster/README.md | 2 ++ modules/beta-private-cluster/cluster.tf | 19 +++++++++++++++- modules/beta-private-cluster/variables.tf | 22 +++++++++++++++++++ .../variables_defaults.tf | 20 +++++++++++++++++ .../README.md | 2 ++ .../cluster.tf | 19 +++++++++++++++- .../variables.tf | 22 +++++++++++++++++++ .../variables_defaults.tf | 20 +++++++++++++++++ modules/beta-public-cluster/README.md | 2 ++ modules/beta-public-cluster/cluster.tf | 19 +++++++++++++++- modules/beta-public-cluster/variables.tf | 22 +++++++++++++++++++ .../beta-public-cluster/variables_defaults.tf | 20 +++++++++++++++++ .../private-cluster-update-variant/README.md | 2 ++ .../private-cluster-update-variant/cluster.tf | 19 +++++++++++++++- .../variables.tf | 22 +++++++++++++++++++ .../variables_defaults.tf | 20 +++++++++++++++++ modules/private-cluster/README.md | 2 ++ modules/private-cluster/cluster.tf | 19 +++++++++++++++- modules/private-cluster/variables.tf | 22 +++++++++++++++++++ modules/private-cluster/variables_defaults.tf | 20 +++++++++++++++++ .../node_pool/testdata/TestNodePool.json | 20 +++++++++++++++++ variables.tf | 22 +++++++++++++++++++ variables_defaults.tf | 20 +++++++++++++++++ 33 files changed, 524 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 14097a8e46..7e9ead3a8e 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 7c2a4e51f8..5a4f44a051 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -1110,7 +1110,11 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : {cgroup = local.node_pools_cgroup_mode[each.value["name"]]} + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : {cgroup = local.node_pools_cgroup_mode[each.value["name"]]}, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -1119,6 +1123,19 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } {% endif %} diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index 888466a768..fce4814fd0 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -248,6 +248,28 @@ variable "node_pools_cgroup_mode" { default-node-pool = "" } } + +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} {% endif %} variable "enable_cost_allocation" { diff --git a/autogen/main/variables_defaults.tf.tmpl b/autogen/main/variables_defaults.tf.tmpl index 0348cc8c1f..95138d7d1f 100644 --- a/autogen/main/variables_defaults.tf.tmpl +++ b/autogen/main/variables_defaults.tf.tmpl @@ -138,5 +138,25 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } {% endif %} diff --git a/cluster.tf b/cluster.tf index 7565c09ecb..25dd9a1939 100644 --- a/cluster.tf +++ b/cluster.tf @@ -806,7 +806,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -815,6 +819,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/examples/node_pool/main.tf b/examples/node_pool/main.tf index a15ba27e46..d9edb142cd 100644 --- a/examples/node_pool/main.tf +++ b/examples/node_pool/main.tf @@ -155,4 +155,14 @@ module "gke" { all = "CGROUP_MODE_V1" pool-01 = "CGROUP_MODE_V2" } + + node_pools_hugepage_size_2m = { + all = "1" + pool-01 = "2" + } + + node_pools_hugepage_size_1g = { + all = "1" + pool-03 = "2" + } } diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index ced7bfc6d5..007b292957 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -265,6 +265,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index fdb0a70bc1..ed1618b726 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -976,7 +976,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -985,6 +989,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index 160af23f15..cd76812b51 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/beta-private-cluster-update-variant/variables_defaults.tf b/modules/beta-private-cluster-update-variant/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/beta-private-cluster-update-variant/variables_defaults.tf +++ b/modules/beta-private-cluster-update-variant/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index f281dfb5b9..2c2d19f2e1 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -243,6 +243,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index d90364d1f6..659ac63fb3 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -895,7 +895,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -904,6 +908,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index 160af23f15..cd76812b51 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/beta-private-cluster/variables_defaults.tf b/modules/beta-private-cluster/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/beta-private-cluster/variables_defaults.tf +++ b/modules/beta-private-cluster/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index a9462dee5b..b46ec56230 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -255,6 +255,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 560f44819b..bb304dd4dd 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -946,7 +946,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -955,6 +959,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/beta-public-cluster-update-variant/variables.tf b/modules/beta-public-cluster-update-variant/variables.tf index 540e0fbad3..d10d8013be 100644 --- a/modules/beta-public-cluster-update-variant/variables.tf +++ b/modules/beta-public-cluster-update-variant/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/beta-public-cluster-update-variant/variables_defaults.tf b/modules/beta-public-cluster-update-variant/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/beta-public-cluster-update-variant/variables_defaults.tf +++ b/modules/beta-public-cluster-update-variant/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index dbbf75fd13..42accad98a 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -233,6 +233,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index fd14173522..ece1f6f664 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -865,7 +865,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -874,6 +878,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index 540e0fbad3..d10d8013be 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/beta-public-cluster/variables_defaults.tf b/modules/beta-public-cluster/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/beta-public-cluster/variables_defaults.tf +++ b/modules/beta-public-cluster/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 8f36ed9ec3..f5a07c3ec4 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -254,6 +254,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 9ce30198e0..ce5df17244 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -916,7 +916,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -925,6 +929,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/private-cluster-update-variant/variables.tf b/modules/private-cluster-update-variant/variables.tf index c691a887ac..5d4c49b78b 100644 --- a/modules/private-cluster-update-variant/variables.tf +++ b/modules/private-cluster-update-variant/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/private-cluster-update-variant/variables_defaults.tf b/modules/private-cluster-update-variant/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/private-cluster-update-variant/variables_defaults.tf +++ b/modules/private-cluster-update-variant/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 131f07aeac..342b764563 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -232,6 +232,8 @@ Then perform the following commands on the root folder: | node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no | | node\_pools | List of maps containing node pools | `list(map(any))` |
[
{
"name": "default-node-pool"
}
]
| no | | node\_pools\_cgroup\_mode | Map of strings containing cgroup node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_1g | Map of strings containing hugepage size 1g config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | +| node\_pools\_hugepage\_size\_2m | Map of strings containing hugepage size 2m node config by node-pool name | `map(string)` |
{
"all": "",
"default-node-pool": ""
}
| no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
{
"all": {},
"default-node-pool": {}
}
| no | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 2094613ff8..df7b49c5c6 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -836,7 +836,11 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls["all"], local.node_pools_linux_node_configs_sysctls[each.value["name"]], local.node_pools_cgroup_mode["all"] == "" ? {} : { cgroup = local.node_pools_cgroup_mode["all"] }, - local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] } + local.node_pools_cgroup_mode[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_cgroup_mode[each.value["name"]] }, + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, )) != 0 ? [1] : [] content { @@ -845,6 +849,19 @@ resource "google_container_node_pool" "pools" { local.node_pools_linux_node_configs_sysctls[each.value["name"]] ) cgroup_mode = coalesce(local.node_pools_cgroup_mode[each.value["name"]], local.node_pools_cgroup_mode["all"], null) + dynamic "hugepages_config" { + for_each = length(merge( + local.node_pools_hugepage_size_2m["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m["all"] }, + local.node_pools_hugepage_size_2m[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_2m[each.value["name"]] }, + local.node_pools_hugepage_size_1g["all"] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g["all"] }, + local.node_pools_hugepage_size_1g[each.value["name"]] == "" ? {} : { cgroup = local.node_pools_hugepage_size_1g[each.value["name"]] }, + )) != 0 ? [1] : [] + + content { + hugepage_size_2m = coalesce(local.node_pools_hugepage_size_2m[each.value["name"]], local.node_pools_hugepage_size_2m["all"], null) + hugepage_size_1g = coalesce(local.node_pools_hugepage_size_1g[each.value["name"]], local.node_pools_hugepage_size_1g["all"], null) + } + } } } diff --git a/modules/private-cluster/variables.tf b/modules/private-cluster/variables.tf index c691a887ac..5d4c49b78b 100644 --- a/modules/private-cluster/variables.tf +++ b/modules/private-cluster/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/modules/private-cluster/variables_defaults.tf b/modules/private-cluster/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/modules/private-cluster/variables_defaults.tf +++ b/modules/private-cluster/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } diff --git a/test/integration/node_pool/testdata/TestNodePool.json b/test/integration/node_pool/testdata/TestNodePool.json index 2175d01c60..db38565c64 100644 --- a/test/integration/node_pool/testdata/TestNodePool.json +++ b/test/integration/node_pool/testdata/TestNodePool.json @@ -337,6 +337,10 @@ "sysctls": { "net.core.netdev_max_backlog": "10000", "net.core.rmem_max": "10000" + }, + "hugepages": { + "hugepageSize2m": "2", + "hugepageSize1g": "1" } }, "loggingConfig": { @@ -435,6 +439,10 @@ "linuxNodeConfig": { "sysctls": { "net.core.netdev_max_backlog": "10000" + }, + "hugepages": { + "hugepageSize2m": "1", + "hugepageSize1g": "1" } }, "loggingConfig": { @@ -522,6 +530,10 @@ "linuxNodeConfig": { "sysctls": { "net.core.netdev_max_backlog": "20000" + }, + "hugepages": { + "hugepageSize2m": "1", + "hugepageSize1g": "2" } }, "loggingConfig": { @@ -613,6 +625,10 @@ "linuxNodeConfig": { "sysctls": { "net.core.netdev_max_backlog": "10000" + }, + "hugepages": { + "hugepageSize2m": "1", + "hugepageSize1g": "1" } }, "loggingConfig": { @@ -708,6 +724,10 @@ "linuxNodeConfig": { "sysctls": { "net.core.netdev_max_backlog": "10000" + }, + "hugepages": { + "hugepageSize2m": "1", + "hugepageSize1g": "1" } }, "loggingConfig": { diff --git a/variables.tf b/variables.tf index 989b8d89f9..fe04327eac 100644 --- a/variables.tf +++ b/variables.tf @@ -246,6 +246,28 @@ variable "node_pools_cgroup_mode" { } } +variable "node_pools_hugepage_size_2m" { + type = map(string) + description = "Map of strings containing hugepage size 2m node config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + +variable "node_pools_hugepage_size_1g" { + type = map(string) + description = "Map of strings containing hugepage size 1g config by node-pool name" + + # Default is being set in variables_defaults.tf + default = { + all = "" + default-node-pool = "" + } +} + variable "enable_cost_allocation" { type = bool description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery" diff --git a/variables_defaults.tf b/variables_defaults.tf index 5c7f51b42f..efa9ecedd7 100644 --- a/variables_defaults.tf +++ b/variables_defaults.tf @@ -137,4 +137,24 @@ locals { ), var.node_pools_cgroup_mode ) + + node_pools_hugepage_size_2m = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_2m + ) + + node_pools_hugepage_size_1g = merge( + { all = "" }, + { default-node-pool = "" }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : ""] + ), + var.node_pools_hugepage_size_1g + ) } From 51a780f003e3295afdefa400099f7ee5ceec5700 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Sat, 4 Jan 2025 17:52:02 -0500 Subject: [PATCH 2/2] align tests Signed-off-by: drfaust92 --- examples/node_pool/main.tf | 5 ++--- .../node_pool/testdata/TestNodePool.json | 14 +++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/examples/node_pool/main.tf b/examples/node_pool/main.tf index d9edb142cd..d389db4a32 100644 --- a/examples/node_pool/main.tf +++ b/examples/node_pool/main.tf @@ -92,7 +92,7 @@ module "gke" { }, { name = "pool-05" - machine_type = "n1-standard-2" + machine_type = "c3-standard-4" node_count = 1 enable_nested_virtualization = true }, @@ -162,7 +162,6 @@ module "gke" { } node_pools_hugepage_size_1g = { - all = "1" - pool-03 = "2" + pool-05 = "2" } } diff --git a/test/integration/node_pool/testdata/TestNodePool.json b/test/integration/node_pool/testdata/TestNodePool.json index db38565c64..9ee2541fb2 100644 --- a/test/integration/node_pool/testdata/TestNodePool.json +++ b/test/integration/node_pool/testdata/TestNodePool.json @@ -339,8 +339,7 @@ "net.core.rmem_max": "10000" }, "hugepages": { - "hugepageSize2m": "2", - "hugepageSize1g": "1" + "hugepageSize2m": "2" } }, "loggingConfig": { @@ -441,8 +440,7 @@ "net.core.netdev_max_backlog": "10000" }, "hugepages": { - "hugepageSize2m": "1", - "hugepageSize1g": "1" + "hugepageSize2m": "1" } }, "loggingConfig": { @@ -532,8 +530,7 @@ "net.core.netdev_max_backlog": "20000" }, "hugepages": { - "hugepageSize2m": "1", - "hugepageSize1g": "2" + "hugepageSize2m": "1" } }, "loggingConfig": { @@ -627,8 +624,7 @@ "net.core.netdev_max_backlog": "10000" }, "hugepages": { - "hugepageSize2m": "1", - "hugepageSize1g": "1" + "hugepageSize2m": "1" } }, "loggingConfig": { @@ -735,7 +731,7 @@ "variant": "DEFAULT" } }, - "machineType": "n1-standard-2", + "machineType": "c3-standard-4", "metadata": { "cluster_name": "node-pool-cluster-RANDOM_STRING", "disable-legacy-endpoints": "false",