Skip to content

Commit c87333b

Browse files
authored
feat(TPG>=5.21)!: add queued_provisioning (terraform-google-modules#1950)
1 parent b57387c commit c87333b

File tree

22 files changed

+240
-6
lines changed

22 files changed

+240
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ The node_pools variable takes the following parameters:
334334
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
335335
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
336336
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
337+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
337338

338339
## windows_node_pools variable
339340
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ The node_pools variable takes the following parameters:
259259
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
260260
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
261261
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
262+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
262263

263264
## windows_node_pools variable
264265
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

autogen/main/cluster.tf.tmpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ locals {
660660
"enable_gvnic",
661661
"enable_secure_boot",
662662
"boot_disk_kms_key",
663+
"queued_provisioning",
663664
]
664665
}
665666

@@ -813,6 +814,13 @@ resource "google_container_node_pool" "windows_pools" {
813814
}
814815
}
815816

817+
dynamic "queued_provisioning" {
818+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
819+
content {
820+
enabled = lookup(each.value, "queued_provisioning", null)
821+
}
822+
}
823+
816824
node_config {
817825
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
818826
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -829,6 +837,12 @@ resource "google_container_node_pool" "windows_pools" {
829837
enabled = gvnic.value
830838
}
831839
}
840+
dynamic "reservation_affinity" {
841+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
842+
content {
843+
consume_reservation_type = "NO_RESERVATION"
844+
}
845+
}
832846
labels = merge(
833847
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
834848
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ terraform {
4646
required_providers {
4747
google = {
4848
source = "hashicorp/google"
49-
version = ">= 5.9.0, < 6"
49+
version = ">= 5.21.0, < 6"
5050
}
5151
kubernetes = {
5252
source = "hashicorp/kubernetes"

cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,13 @@ resource "google_container_node_pool" "pools" {
536536
}
537537
}
538538

539+
dynamic "queued_provisioning" {
540+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
541+
content {
542+
enabled = lookup(each.value, "queued_provisioning", null)
543+
}
544+
}
545+
539546
node_config {
540547
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
541548
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -552,6 +559,12 @@ resource "google_container_node_pool" "pools" {
552559
enabled = gvnic.value
553560
}
554561
}
562+
dynamic "reservation_affinity" {
563+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
564+
content {
565+
consume_reservation_type = "NO_RESERVATION"
566+
}
567+
}
555568
labels = merge(
556569
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
557570
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
@@ -782,6 +795,13 @@ resource "google_container_node_pool" "windows_pools" {
782795
}
783796
}
784797

798+
dynamic "queued_provisioning" {
799+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
800+
content {
801+
enabled = lookup(each.value, "queued_provisioning", null)
802+
}
803+
}
804+
785805
node_config {
786806
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
787807
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -798,6 +818,12 @@ resource "google_container_node_pool" "windows_pools" {
798818
enabled = gvnic.value
799819
}
800820
}
821+
dynamic "reservation_affinity" {
822+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
823+
content {
824+
consume_reservation_type = "NO_RESERVATION"
825+
}
826+
}
801827
labels = merge(
802828
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
803829
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},

examples/node_pool/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ module "gke" {
8080
cpu_cfs_quota = true
8181
local_ssd_ephemeral_count = 2
8282
},
83+
{
84+
name = "pool-04"
85+
min_count = 0
86+
service_account = var.compute_engine_service_account
87+
queued_provisioning = true
88+
},
8389
]
8490

8591
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
@@ -400,6 +400,7 @@ The node_pools variable takes the following parameters:
400400
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
401401
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
402402
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
403+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
403404

404405
## windows_node_pools variable
405406
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ locals {
569569
"enable_gvnic",
570570
"enable_secure_boot",
571571
"boot_disk_kms_key",
572+
"queued_provisioning",
572573
]
573574
}
574575

@@ -699,6 +700,13 @@ resource "google_container_node_pool" "pools" {
699700
}
700701
}
701702

703+
dynamic "queued_provisioning" {
704+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
705+
content {
706+
enabled = lookup(each.value, "queued_provisioning", null)
707+
}
708+
}
709+
702710
node_config {
703711
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
704712
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -715,6 +723,12 @@ resource "google_container_node_pool" "pools" {
715723
enabled = gvnic.value
716724
}
717725
}
726+
dynamic "reservation_affinity" {
727+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
728+
content {
729+
consume_reservation_type = "NO_RESERVATION"
730+
}
731+
}
718732
labels = merge(
719733
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
720734
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
@@ -971,6 +985,13 @@ resource "google_container_node_pool" "windows_pools" {
971985
}
972986
}
973987

988+
dynamic "queued_provisioning" {
989+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
990+
content {
991+
enabled = lookup(each.value, "queued_provisioning", null)
992+
}
993+
}
994+
974995
node_config {
975996
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
976997
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -987,6 +1008,12 @@ resource "google_container_node_pool" "windows_pools" {
9871008
enabled = gvnic.value
9881009
}
9891010
}
1011+
dynamic "reservation_affinity" {
1012+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
1013+
content {
1014+
consume_reservation_type = "NO_RESERVATION"
1015+
}
1016+
}
9901017
labels = merge(
9911018
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
9921019
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ The node_pools variable takes the following parameters:
378378
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
379379
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
380380
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
381+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
381382

382383
## windows_node_pools variable
383384
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

modules/beta-private-cluster/cluster.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@ resource "google_container_node_pool" "pools" {
621621
}
622622
}
623623

624+
dynamic "queued_provisioning" {
625+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
626+
content {
627+
enabled = lookup(each.value, "queued_provisioning", null)
628+
}
629+
}
630+
624631
node_config {
625632
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
626633
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -637,6 +644,12 @@ resource "google_container_node_pool" "pools" {
637644
enabled = gvnic.value
638645
}
639646
}
647+
dynamic "reservation_affinity" {
648+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
649+
content {
650+
consume_reservation_type = "NO_RESERVATION"
651+
}
652+
}
640653
labels = merge(
641654
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
642655
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
@@ -892,6 +905,13 @@ resource "google_container_node_pool" "windows_pools" {
892905
}
893906
}
894907

908+
dynamic "queued_provisioning" {
909+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
910+
content {
911+
enabled = lookup(each.value, "queued_provisioning", null)
912+
}
913+
}
914+
895915
node_config {
896916
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
897917
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -908,6 +928,12 @@ resource "google_container_node_pool" "windows_pools" {
908928
enabled = gvnic.value
909929
}
910930
}
931+
dynamic "reservation_affinity" {
932+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
933+
content {
934+
consume_reservation_type = "NO_RESERVATION"
935+
}
936+
}
911937
labels = merge(
912938
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
913939
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ The node_pools variable takes the following parameters:
388388
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
389389
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
390390
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
391+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
391392

392393
## windows_node_pools variable
393394
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ locals {
550550
"enable_gvnic",
551551
"enable_secure_boot",
552552
"boot_disk_kms_key",
553+
"queued_provisioning",
553554
]
554555
}
555556

@@ -680,6 +681,13 @@ resource "google_container_node_pool" "pools" {
680681
}
681682
}
682683

684+
dynamic "queued_provisioning" {
685+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
686+
content {
687+
enabled = lookup(each.value, "queued_provisioning", null)
688+
}
689+
}
690+
683691
node_config {
684692
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
685693
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -696,6 +704,12 @@ resource "google_container_node_pool" "pools" {
696704
enabled = gvnic.value
697705
}
698706
}
707+
dynamic "reservation_affinity" {
708+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
709+
content {
710+
consume_reservation_type = "NO_RESERVATION"
711+
}
712+
}
699713
labels = merge(
700714
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
701715
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
@@ -952,6 +966,13 @@ resource "google_container_node_pool" "windows_pools" {
952966
}
953967
}
954968

969+
dynamic "queued_provisioning" {
970+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
971+
content {
972+
enabled = lookup(each.value, "queued_provisioning", null)
973+
}
974+
}
975+
955976
node_config {
956977
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
957978
machine_type = lookup(each.value, "machine_type", "e2-medium")
@@ -968,6 +989,12 @@ resource "google_container_node_pool" "windows_pools" {
968989
enabled = gvnic.value
969990
}
970991
}
992+
dynamic "reservation_affinity" {
993+
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
994+
content {
995+
consume_reservation_type = "NO_RESERVATION"
996+
}
997+
}
971998
labels = merge(
972999
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
9731000
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ The node_pools variable takes the following parameters:
366366
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
367367
| location_policy | [Location policy](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#location_policy) specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters. | " " | Optional |
368368
| secondary_boot_disk | Image of a secondary boot disk to preload container images and data on new nodes. For detail see [documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#nested_secondary_boot_disks). `gcfs_config` must be `enabled=true` for this feature to work. | | Optional |
369+
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |
369370

370371
## windows_node_pools variable
371372
The windows_node_pools variable takes the same parameters as [node_pools](#node\_pools-variable) but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy a [specific requirement](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#create_a_cluster_and_node_pools) for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

0 commit comments

Comments
 (0)