Skip to content

Commit e298e74

Browse files
DrFaust92apeabody
andauthored
feat: support enable_nested_virtualization (#2012)
Co-authored-by: Andrew Peabody <[email protected]>
1 parent be88d19 commit e298e74

File tree

18 files changed

+82
-32
lines changed

18 files changed

+82
-32
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ The node_pools variable takes the following parameters:
328328
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
329329
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
330330
| 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 |
331+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
331332
| 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 |
332333
| 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 |
333334
| 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 |

autogen/main/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ The node_pools variable takes the following parameters:
229229
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
230230
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
231231
| 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 |
232+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
232233
| 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 |
233234
| 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 |
234235
| 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 |

autogen/main/cluster.tf.tmpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,9 +992,10 @@ resource "google_container_node_pool" "windows_pools" {
992992
}
993993

994994
dynamic "advanced_machine_features" {
995-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
995+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
996996
content {
997-
threads_per_core = lookup(each.value, "threads_per_core", 0)
997+
threads_per_core = lookup(each.value, "threads_per_core", 0)
998+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
998999
}
9991000
}
10001001

cluster.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,10 @@ resource "google_container_node_pool" "pools" {
697697
}
698698

699699
dynamic "advanced_machine_features" {
700-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
700+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
701701
content {
702-
threads_per_core = lookup(each.value, "threads_per_core", 0)
702+
threads_per_core = lookup(each.value, "threads_per_core", 0)
703+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
703704
}
704705
}
705706

@@ -970,9 +971,10 @@ resource "google_container_node_pool" "windows_pools" {
970971
}
971972

972973
dynamic "advanced_machine_features" {
973-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
974+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
974975
content {
975-
threads_per_core = lookup(each.value, "threads_per_core", 0)
976+
threads_per_core = lookup(each.value, "threads_per_core", 0)
977+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
976978
}
977979
}
978980

examples/node_pool/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ module "gke" {
8787
service_account = var.compute_engine_service_account
8888
queued_provisioning = true
8989
},
90+
{
91+
name = "pool-05"
92+
machine_type = "n1-standard-2"
93+
node_count = 1
94+
enable_nested_virtualization = true
95+
},
9096
]
9197

9298
node_pools_metadata = {

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ The node_pools variable takes the following parameters:
387387
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
388388
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
389389
| 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 |
390+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
390391
| 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 |
391392
| 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 |
392393
| 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 |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,10 @@ resource "google_container_node_pool" "pools" {
868868
}
869869

870870
dynamic "advanced_machine_features" {
871-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
871+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
872872
content {
873-
threads_per_core = lookup(each.value, "threads_per_core", 0)
873+
threads_per_core = lookup(each.value, "threads_per_core", 0)
874+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
874875
}
875876
}
876877

@@ -1155,9 +1156,10 @@ resource "google_container_node_pool" "windows_pools" {
11551156
}
11561157

11571158
dynamic "advanced_machine_features" {
1158-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1159+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
11591160
content {
1160-
threads_per_core = lookup(each.value, "threads_per_core", 0)
1161+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1162+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
11611163
}
11621164
}
11631165

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ The node_pools variable takes the following parameters:
365365
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
366366
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
367367
| 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 |
368+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
368369
| 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 |
369370
| 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 |
370371
| 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 |

modules/beta-private-cluster/cluster.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,10 @@ resource "google_container_node_pool" "pools" {
788788
}
789789

790790
dynamic "advanced_machine_features" {
791-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
791+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
792792
content {
793-
threads_per_core = lookup(each.value, "threads_per_core", 0)
793+
threads_per_core = lookup(each.value, "threads_per_core", 0)
794+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
794795
}
795796
}
796797

@@ -1074,9 +1075,10 @@ resource "google_container_node_pool" "windows_pools" {
10741075
}
10751076

10761077
dynamic "advanced_machine_features" {
1077-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1078+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
10781079
content {
1079-
threads_per_core = lookup(each.value, "threads_per_core", 0)
1080+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1081+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
10801082
}
10811083
}
10821084

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ The node_pools variable takes the following parameters:
373373
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
374374
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
375375
| 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 |
376+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
376377
| 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 |
377378
| 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 |
378379
| 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 |

0 commit comments

Comments
 (0)