Skip to content

Commit 8fdfd20

Browse files
authored
feat: add tpu_topology and policy_name args in placement_policy (#2363)
Signed-off-by: drfaust92 <[email protected]>
1 parent c80e88f commit 8fdfd20

File tree

16 files changed

+69
-15
lines changed

16 files changed

+69
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ The node_pools variable takes the following parameters:
371371
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
372372
| name | The name of the node pool | | Required |
373373
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
374+
| policy_name | If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. | | Optional |
375+
| tpu_topology | TPU placement topology for pod slice node pool. For detail see [documentation](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) | | Optional |
374376
| pod_range | The name of the secondary range for pod IPs. | | Optional |
375377
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
376378
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |

autogen/main/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ The node_pools variable takes the following parameters:
252252
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
253253
| name | The name of the node pool | | Required |
254254
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
255+
| policy_name | If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. | | Optional |
256+
| tpu_topology | TPU placement topology for pod slice node pool. For detail see [documentation](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) | | Optional |
255257
| pod_range | The name of the secondary range for pod IPs. | | Optional |
256258
{% if not private_cluster %}
257259
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |

autogen/main/cluster.tf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ locals {
805805
"local_ssd_ephemeral_count",
806806
{% endif %}
807807
"placement_policy",
808+
"policy_name",
809+
"tpu_topology",
808810
"max_pods_per_node",
809811
"min_cpu_platform",
810812
"pod_range",
@@ -932,7 +934,9 @@ resource "google_container_node_pool" "windows_pools" {
932934
dynamic "placement_policy" {
933935
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
934936
content {
935-
type = lookup(placement_policy.value, "placement_policy", null)
937+
type = lookup(placement_policy.value, "placement_policy", null)
938+
policy_name = lookup(placement_policy.value, "policy_name", null)
939+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
936940
}
937941
}
938942

cluster.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,9 @@ resource "google_container_node_pool" "pools" {
649649
dynamic "placement_policy" {
650650
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
651651
content {
652-
type = lookup(placement_policy.value, "placement_policy", null)
652+
type = lookup(placement_policy.value, "placement_policy", null)
653+
policy_name = lookup(placement_policy.value, "policy_name", null)
654+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
653655
}
654656
}
655657

@@ -1001,7 +1003,9 @@ resource "google_container_node_pool" "windows_pools" {
10011003
dynamic "placement_policy" {
10021004
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
10031005
content {
1004-
type = lookup(placement_policy.value, "placement_policy", null)
1006+
type = lookup(placement_policy.value, "placement_policy", null)
1007+
policy_name = lookup(placement_policy.value, "policy_name", null)
1008+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
10051009
}
10061010
}
10071011

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ The node_pools variable takes the following parameters:
425425
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
426426
| name | The name of the node pool | | Required |
427427
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
428+
| policy_name | If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. | | Optional |
429+
| tpu_topology | TPU placement topology for pod slice node pool. For detail see [documentation](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) | | Optional |
428430
| pod_range | The name of the secondary range for pod IPs. | | Optional |
429431
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |
430432
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,8 @@ locals {
689689
"local_ssd_count",
690690
"local_ssd_ephemeral_count",
691691
"placement_policy",
692+
"policy_name",
693+
"tpu_topology",
692694
"max_pods_per_node",
693695
"min_cpu_platform",
694696
"pod_range",
@@ -797,7 +799,9 @@ resource "google_container_node_pool" "pools" {
797799
dynamic "placement_policy" {
798800
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
799801
content {
800-
type = lookup(placement_policy.value, "placement_policy", null)
802+
type = lookup(placement_policy.value, "placement_policy", null)
803+
policy_name = lookup(placement_policy.value, "policy_name", null)
804+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
801805
}
802806
}
803807

@@ -1163,7 +1167,9 @@ resource "google_container_node_pool" "windows_pools" {
11631167
dynamic "placement_policy" {
11641168
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
11651169
content {
1166-
type = lookup(placement_policy.value, "placement_policy", null)
1170+
type = lookup(placement_policy.value, "placement_policy", null)
1171+
policy_name = lookup(placement_policy.value, "policy_name", null)
1172+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
11671173
}
11681174
}
11691175

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ The node_pools variable takes the following parameters:
403403
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
404404
| name | The name of the node pool | | Required |
405405
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
406+
| policy_name | If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. | | Optional |
407+
| tpu_topology | TPU placement topology for pod slice node pool. For detail see [documentation](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) | | Optional |
406408
| pod_range | The name of the secondary range for pod IPs. | | Optional |
407409
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |
408410
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |

modules/beta-private-cluster/cluster.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,9 @@ resource "google_container_node_pool" "pools" {
717717
dynamic "placement_policy" {
718718
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
719719
content {
720-
type = lookup(placement_policy.value, "placement_policy", null)
720+
type = lookup(placement_policy.value, "placement_policy", null)
721+
policy_name = lookup(placement_policy.value, "policy_name", null)
722+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
721723
}
722724
}
723725

@@ -1082,7 +1084,9 @@ resource "google_container_node_pool" "windows_pools" {
10821084
dynamic "placement_policy" {
10831085
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
10841086
content {
1085-
type = lookup(placement_policy.value, "placement_policy", null)
1087+
type = lookup(placement_policy.value, "placement_policy", null)
1088+
policy_name = lookup(placement_policy.value, "policy_name", null)
1089+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
10861090
}
10871091
}
10881092

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ The node_pools variable takes the following parameters:
411411
| total_min_count | Total minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits. | null | Optional |
412412
| name | The name of the node pool | | Required |
413413
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
414+
| policy_name | If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. | | Optional |
415+
| tpu_topology | TPU placement topology for pod slice node pool. For detail see [documentation](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) | | Optional |
414416
| pod_range | The name of the secondary range for pod IPs. | | Optional |
415417
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
416418
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,8 @@ locals {
667667
"local_ssd_count",
668668
"local_ssd_ephemeral_count",
669669
"placement_policy",
670+
"policy_name",
671+
"tpu_topology",
670672
"max_pods_per_node",
671673
"min_cpu_platform",
672674
"pod_range",
@@ -775,7 +777,9 @@ resource "google_container_node_pool" "pools" {
775777
dynamic "placement_policy" {
776778
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
777779
content {
778-
type = lookup(placement_policy.value, "placement_policy", null)
780+
type = lookup(placement_policy.value, "placement_policy", null)
781+
policy_name = lookup(placement_policy.value, "policy_name", null)
782+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
779783
}
780784
}
781785

@@ -1141,7 +1145,9 @@ resource "google_container_node_pool" "windows_pools" {
11411145
dynamic "placement_policy" {
11421146
for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : []
11431147
content {
1144-
type = lookup(placement_policy.value, "placement_policy", null)
1148+
type = lookup(placement_policy.value, "placement_policy", null)
1149+
policy_name = lookup(placement_policy.value, "policy_name", null)
1150+
tpu_topology = lookup(placement_policy.value, "tpu_topology", null)
11451151
}
11461152
}
11471153

0 commit comments

Comments
 (0)