Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TPG>=5.21)!: add queued_provisioning #1950

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
1 change: 1 addition & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
14 changes: 14 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -813,6 +814,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -829,6 +837,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5.9.0, < 6"
version = ">= 5.21.0, < 6"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
26 changes: 26 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -552,6 +559,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -782,6 +795,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -798,6 +818,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
6 changes: 6 additions & 0 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ module "gke" {
cpu_cfs_quota = true
local_ssd_ephemeral_count = 2
},
{
name = "pool-04"
min_count = 0
service_account = var.compute_engine_service_account
queued_provisioning = true
},
]

node_pools_metadata = {
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
27 changes: 27 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -699,6 +700,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -715,6 +723,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -971,6 +985,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -987,6 +1008,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
26 changes: 26 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -637,6 +644,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -892,6 +905,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -908,6 +928,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
27 changes: 27 additions & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -680,6 +681,13 @@ resource "google_container_node_pool" "pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -696,6 +704,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -952,6 +966,13 @@ resource "google_container_node_pool" "windows_pools" {
}
}

dynamic "queued_provisioning" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
enabled = lookup(each.value, "queued_provisioning", null)
}
}

node_config {
image_type = lookup(each.value, "image_type", "COS_CONTAINERD")
machine_type = lookup(each.value, "machine_type", "e2-medium")
Expand All @@ -968,6 +989,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "reservation_affinity" {
for_each = lookup(each.value, "queued_provisioning", false) ? [true] : []
content {
consume_reservation_type = "NO_RESERVATION"
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ The node_pools variable takes the following parameters:
| version | The Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false | " " | Optional |
| 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 |
| 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 |
| queued_provisioning | Makes nodes obtainable through the ProvisioningRequest API exclusively. | | Optional |

## windows_node_pools variable
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.
Expand Down
Loading