Skip to content

Commit e573ced

Browse files
authored
feat: Add threads_per_core setting for node config in node pools (#1942)
1 parent 04ebd0c commit e573ced

File tree

16 files changed

+113
-0
lines changed

16 files changed

+113
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ The node_pools variable takes the following parameters:
308308
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
309309
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
310310
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
311+
| 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 |
311312
| 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 |
312313
| 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 |
313314
| 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
@@ -223,6 +223,7 @@ The node_pools variable takes the following parameters:
223223
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
224224
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
225225
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
226+
| 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 |
226227
| 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 |
227228
| 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 |
228229
| 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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,13 @@ resource "google_container_node_pool" "windows_pools" {
930930
}
931931
}
932932

933+
dynamic "advanced_machine_features" {
934+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
935+
content {
936+
threads_per_core = lookup(each.value, "threads_per_core", 0)
937+
}
938+
}
939+
933940
dynamic "workload_metadata_config" {
934941
for_each = local.cluster_node_metadata_config
935942

cluster.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,13 @@ resource "google_container_node_pool" "pools" {
647647
}
648648
}
649649

650+
dynamic "advanced_machine_features" {
651+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
652+
content {
653+
threads_per_core = lookup(each.value, "threads_per_core", 0)
654+
}
655+
}
656+
650657
dynamic "workload_metadata_config" {
651658
for_each = local.cluster_node_metadata_config
652659

@@ -878,6 +885,13 @@ resource "google_container_node_pool" "windows_pools" {
878885
}
879886
}
880887

888+
dynamic "advanced_machine_features" {
889+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
890+
content {
891+
threads_per_core = lookup(each.value, "threads_per_core", 0)
892+
}
893+
}
894+
881895
dynamic "workload_metadata_config" {
882896
for_each = local.cluster_node_metadata_config
883897

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ The node_pools variable takes the following parameters:
371371
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
372372
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
373373
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
374+
| 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 |
374375
| 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 |
375376
| 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 |
376377
| 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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,13 @@ resource "google_container_node_pool" "pools" {
814814
}
815815
}
816816

817+
dynamic "advanced_machine_features" {
818+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
819+
content {
820+
threads_per_core = lookup(each.value, "threads_per_core", 0)
821+
}
822+
}
823+
817824
dynamic "workload_metadata_config" {
818825
for_each = local.cluster_node_metadata_config
819826

@@ -1071,6 +1078,13 @@ resource "google_container_node_pool" "windows_pools" {
10711078
}
10721079
}
10731080

1081+
dynamic "advanced_machine_features" {
1082+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1083+
content {
1084+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1085+
}
1086+
}
1087+
10741088
dynamic "workload_metadata_config" {
10751089
for_each = local.cluster_node_metadata_config
10761090

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ The node_pools variable takes the following parameters:
349349
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
350350
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
351351
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
352+
| 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 |
352353
| 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 |
353354
| 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 |
354355
| 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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,13 @@ resource "google_container_node_pool" "pools" {
738738
}
739739
}
740740

741+
dynamic "advanced_machine_features" {
742+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
743+
content {
744+
threads_per_core = lookup(each.value, "threads_per_core", 0)
745+
}
746+
}
747+
741748
dynamic "workload_metadata_config" {
742749
for_each = local.cluster_node_metadata_config
743750

@@ -994,6 +1001,13 @@ resource "google_container_node_pool" "windows_pools" {
9941001
}
9951002
}
9961003

1004+
dynamic "advanced_machine_features" {
1005+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1006+
content {
1007+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1008+
}
1009+
}
1010+
9971011
dynamic "workload_metadata_config" {
9981012
for_each = local.cluster_node_metadata_config
9991013

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ The node_pools variable takes the following parameters:
358358
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
359359
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
360360
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
361+
| 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 |
361362
| 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 |
362363
| 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 |
363364
| 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-public-cluster-update-variant/cluster.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,13 @@ resource "google_container_node_pool" "pools" {
795795
}
796796
}
797797

798+
dynamic "advanced_machine_features" {
799+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
800+
content {
801+
threads_per_core = lookup(each.value, "threads_per_core", 0)
802+
}
803+
}
804+
798805
dynamic "workload_metadata_config" {
799806
for_each = local.cluster_node_metadata_config
800807

@@ -1052,6 +1059,13 @@ resource "google_container_node_pool" "windows_pools" {
10521059
}
10531060
}
10541061

1062+
dynamic "advanced_machine_features" {
1063+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
1064+
content {
1065+
threads_per_core = lookup(each.value, "threads_per_core", 0)
1066+
}
1067+
}
1068+
10551069
dynamic "workload_metadata_config" {
10561070
for_each = local.cluster_node_metadata_config
10571071

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ The node_pools variable takes the following parameters:
336336
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
337337
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
338338
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
339+
| 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 |
339340
| 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 |
340341
| 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 |
341342
| 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-public-cluster/cluster.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,13 @@ resource "google_container_node_pool" "pools" {
719719
}
720720
}
721721

722+
dynamic "advanced_machine_features" {
723+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
724+
content {
725+
threads_per_core = lookup(each.value, "threads_per_core", 0)
726+
}
727+
}
728+
722729
dynamic "workload_metadata_config" {
723730
for_each = local.cluster_node_metadata_config
724731

@@ -975,6 +982,13 @@ resource "google_container_node_pool" "windows_pools" {
975982
}
976983
}
977984

985+
dynamic "advanced_machine_features" {
986+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
987+
content {
988+
threads_per_core = lookup(each.value, "threads_per_core", 0)
989+
}
990+
}
991+
978992
dynamic "workload_metadata_config" {
979993
for_each = local.cluster_node_metadata_config
980994

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ The node_pools variable takes the following parameters:
343343
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
344344
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
345345
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
346+
| 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 |
346347
| 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 |
347348
| 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 |
348349
| 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/private-cluster-update-variant/cluster.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,13 @@ resource "google_container_node_pool" "pools" {
742742
}
743743
}
744744

745+
dynamic "advanced_machine_features" {
746+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
747+
content {
748+
threads_per_core = lookup(each.value, "threads_per_core", 0)
749+
}
750+
}
751+
745752
dynamic "workload_metadata_config" {
746753
for_each = local.cluster_node_metadata_config
747754

@@ -974,6 +981,13 @@ resource "google_container_node_pool" "windows_pools" {
974981
}
975982
}
976983

984+
dynamic "advanced_machine_features" {
985+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
986+
content {
987+
threads_per_core = lookup(each.value, "threads_per_core", 0)
988+
}
989+
}
990+
977991
dynamic "workload_metadata_config" {
978992
for_each = local.cluster_node_metadata_config
979993

modules/private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ The node_pools variable takes the following parameters:
321321
| total_max_count | Total maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits. | null | Optional |
322322
| max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional |
323323
| strategy | The upgrade stragey to be used for upgrading the nodes. Valid values of state are: `SURGE` or `BLUE_GREEN` | "SURGE" | Optional |
324+
| 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 |
324325
| 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 |
325326
| 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 |
326327
| 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/private-cluster/cluster.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,13 @@ resource "google_container_node_pool" "pools" {
666666
}
667667
}
668668

669+
dynamic "advanced_machine_features" {
670+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
671+
content {
672+
threads_per_core = lookup(each.value, "threads_per_core", 0)
673+
}
674+
}
675+
669676
dynamic "workload_metadata_config" {
670677
for_each = local.cluster_node_metadata_config
671678

@@ -897,6 +904,13 @@ resource "google_container_node_pool" "windows_pools" {
897904
}
898905
}
899906

907+
dynamic "advanced_machine_features" {
908+
for_each = lookup(each.value, "threads_per_core", 0) > 0 ? [1] : []
909+
content {
910+
threads_per_core = lookup(each.value, "threads_per_core", 0)
911+
}
912+
}
913+
900914
dynamic "workload_metadata_config" {
901915
for_each = local.cluster_node_metadata_config
902916

0 commit comments

Comments
 (0)