Skip to content

Commit

Permalink
feat: support enable_nested_virtualization (#2012)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Peabody <[email protected]>
  • Loading branch information
DrFaust92 and apeabody authored Aug 5, 2024
1 parent be88d19 commit e298e74
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 32 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
1 change: 1 addition & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
5 changes: 3 additions & 2 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -992,9 +992,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
10 changes: 6 additions & 4 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -970,9 +971,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
6 changes: 6 additions & 0 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ module "gke" {
service_account = var.compute_engine_service_account
queued_provisioning = true
},
{
name = "pool-05"
machine_type = "n1-standard-2"
node_count = 1
enable_nested_virtualization = true
},
]

node_pools_metadata = {
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
10 changes: 6 additions & 4 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -1155,9 +1156,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
10 changes: 6 additions & 4 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -1074,9 +1075,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
10 changes: 6 additions & 4 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -1134,9 +1135,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
10 changes: 6 additions & 4 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -1053,9 +1054,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ The node_pools variable takes the following parameters:
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
| threads_per_core | Optional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed | null | Optional |
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
| max_surge | The number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works with `SURGE` strategy. | 1 | Optional |
| max_unavailable | The number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works with `SURGE` strategy. | 0 | Optional |
| node_pool_soak_duration | Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works with `BLUE_GREEN` strategy. | "3600s" | Optional |
Expand Down
10 changes: 6 additions & 4 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,10 @@ resource "google_container_node_pool" "pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down Expand Up @@ -1072,9 +1073,10 @@ resource "google_container_node_pool" "windows_pools" {
}

dynamic "advanced_machine_features" {
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
content {
threads_per_core = lookup(each.value, "threads_per_core", 0)
threads_per_core = lookup(each.value, "threads_per_core", 0)
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
}
}

Expand Down
Loading

0 comments on commit e298e74

Please sign in to comment.