Skip to content

Commit e298e74

Browse files
DrFaust92apeabody
andauthored
feat: support enable_nested_virtualization (#2012)
Co-authored-by: Andrew Peabody <andrewpeabody@google.com>
1 parent be88d19 commit e298e74

File tree

18 files changed

+82
-32
lines changed

18 files changed

+82
-32
lines changed

Diff for: README.md

+1
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 |

Diff for: autogen/main/README.md

+1
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 |

Diff for: autogen/main/cluster.tf.tmpl

+3-2
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

Diff for: cluster.tf

+6-4
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

Diff for: examples/node_pool/main.tf

+6
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 = {

Diff for: modules/beta-private-cluster-update-variant/README.md

+1
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 |

Diff for: modules/beta-private-cluster-update-variant/cluster.tf

+6-4
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

Diff for: modules/beta-private-cluster/README.md

+1
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 |

Diff for: modules/beta-private-cluster/cluster.tf

+6-4
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

Diff for: modules/beta-public-cluster-update-variant/README.md

+1
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 |

Diff for: modules/beta-public-cluster-update-variant/cluster.tf

+6-4
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,10 @@ resource "google_container_node_pool" "pools" {
847847
}
848848

849849
dynamic "advanced_machine_features" {
850-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
850+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
851851
content {
852-
threads_per_core = lookup(each.value, "threads_per_core", 0)
852+
threads_per_core = lookup(each.value, "threads_per_core", 0)
853+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
853854
}
854855
}
855856

@@ -1134,9 +1135,10 @@ resource "google_container_node_pool" "windows_pools" {
11341135
}
11351136

11361137
dynamic "advanced_machine_features" {
1137-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1138+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
11381139
content {
1139-
threads_per_core = lookup(each.value, "threads_per_core", 0)
1140+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1141+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
11401142
}
11411143
}
11421144

Diff for: modules/beta-public-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ The node_pools variable takes the following parameters:
351351
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
352352
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
353353
| 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 |
354+
| enable_nested_virtualization | Whether the node should have nested virtualization | null | Optional |
354355
| 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 |
355356
| 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 |
356357
| 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 |

Diff for: modules/beta-public-cluster/cluster.tf

+6-4
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,10 @@ resource "google_container_node_pool" "pools" {
767767
}
768768

769769
dynamic "advanced_machine_features" {
770-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
770+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
771771
content {
772-
threads_per_core = lookup(each.value, "threads_per_core", 0)
772+
threads_per_core = lookup(each.value, "threads_per_core", 0)
773+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
773774
}
774775
}
775776

@@ -1053,9 +1054,10 @@ resource "google_container_node_pool" "windows_pools" {
10531054
}
10541055

10551056
dynamic "advanced_machine_features" {
1056-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1057+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
10571058
content {
1058-
threads_per_core = lookup(each.value, "threads_per_core", 0)
1059+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1060+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
10591061
}
10601062
}
10611063

Diff for: modules/private-cluster-update-variant/README.md

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

Diff for: modules/private-cluster-update-variant/cluster.tf

+6-4
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,10 @@ resource "google_container_node_pool" "pools" {
798798
}
799799

800800
dynamic "advanced_machine_features" {
801-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
801+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
802802
content {
803-
threads_per_core = lookup(each.value, "threads_per_core", 0)
803+
threads_per_core = lookup(each.value, "threads_per_core", 0)
804+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
804805
}
805806
}
806807

@@ -1072,9 +1073,10 @@ resource "google_container_node_pool" "windows_pools" {
10721073
}
10731074

10741075
dynamic "advanced_machine_features" {
1075-
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1076+
for_each = lookup(each.value, "threads_per_core", 0) > 0 || lookup(each.value, "enable_nested_virtualization", false) ? [1] : []
10761077
content {
1077-
threads_per_core = lookup(each.value, "threads_per_core", 0)
1078+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1079+
enable_nested_virtualization = lookup(each.value, "enable_nested_virtualization", null)
10781080
}
10791081
}
10801082

0 commit comments

Comments
 (0)