Skip to content

Commit

Permalink
feat: add queued_provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed May 23, 2024
1 parent c51c446 commit c4a7b6e
Show file tree
Hide file tree
Showing 21 changed files with 217 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,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 @@ -254,6 +254,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 @@ -658,6 +658,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -811,6 +812,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 @@ -827,6 +835,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 @@ -774,6 +787,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 @@ -790,6 +810,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 @@ -395,6 +395,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 @@ -567,6 +567,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -697,6 +698,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 @@ -713,6 +721,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 @@ -961,6 +975,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 @@ -977,6 +998,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 @@ -373,6 +373,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 @@ -884,6 +897,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 @@ -900,6 +920,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 @@ -383,6 +383,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 @@ -548,6 +548,7 @@ locals {
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
"queued_provisioning",
]
}

Expand Down Expand Up @@ -678,6 +679,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 @@ -694,6 +702,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 @@ -942,6 +956,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 @@ -958,6 +979,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 @@ -361,6 +361,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

0 comments on commit c4a7b6e

Please sign in to comment.