diff --git a/autogen/main/README.md b/autogen/main/README.md index e7e8dcc154..abe1bb2af6 100644 --- a/autogen/main/README.md +++ b/autogen/main/README.md @@ -189,6 +189,8 @@ The node_pools variable takes the following parameters: | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | {% if beta_cluster %} | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | +| 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. | 1 | Optional | +| 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. | 0 | Optional | {% endif %} | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | | name | The name of the node pool | | Required | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index c8fb7a88a7..0afbf42a40 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -382,6 +382,13 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + {% if beta_cluster %} + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } + {% endif %} + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/cluster.tf b/cluster.tf index 5a5734033f..b56acd0f78 100644 --- a/cluster.tf +++ b/cluster.tf @@ -158,6 +158,7 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 2b6a0b69bb..b64a31c14b 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -276,6 +276,8 @@ The node_pools variable takes the following parameters: | machine_type | The name of a Google Compute Engine machine type | n1-standard-2 | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | +| 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. | 1 | Optional | +| 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. | 0 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | | name | The name of the node pool | | Required | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index c7c6fa55f2..4f6d2865da 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -346,6 +346,11 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 608ecaaaa4..65cf7d581f 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -254,6 +254,8 @@ The node_pools variable takes the following parameters: | machine_type | The name of a Google Compute Engine machine type | n1-standard-2 | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | +| 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. | 1 | Optional | +| 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. | 0 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | | name | The name of the node pool | | Required | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 90fd8ad8ba..33b25e65c8 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -274,6 +274,11 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index baa07bf599..32ef7ce6c9 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -232,6 +232,8 @@ The node_pools variable takes the following parameters: | machine_type | The name of a Google Compute Engine machine type | n1-standard-2 | Optional | | max_count | Maximum number of nodes in the NodePool. Must be >= min_count | 100 | Optional | | max_pods_per_node | The maximum number of pods per node in this cluster | null | Optional | +| 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. | 1 | Optional | +| 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. | 0 | Optional | | min_count | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | 1 | Optional | | name | The name of the node pool | | Required | | node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusers | | Required | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 708f9325d4..1b995231f5 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -261,6 +261,11 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + upgrade_settings { + max_surge = lookup(each.value, "max_surge", 1) + max_unavailable = lookup(each.value, "max_unavailable", 0) + } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7bf369be88..b0a3c1f2a2 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -243,6 +243,7 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2") diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index b1fb0d2fff..811616c091 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -171,6 +171,7 @@ resource "google_container_node_pool" "pools" { auto_upgrade = lookup(each.value, "auto_upgrade", local.default_auto_upgrade) } + node_config { image_type = lookup(each.value, "image_type", "COS") machine_type = lookup(each.value, "machine_type", "n1-standard-2")