Skip to content

Commit

Permalink
feat: Enable Surge Upgrades by specifying max_surge and max_unavailab…
Browse files Browse the repository at this point in the history
…le (Beta) (#394)

BREAKING CHANGE: beta clusters now have surge upgrades turned on by default. This behavior can be tuned using the max_surge and max_unavailable inputs.
  • Loading branch information
Dev25 authored and morgante committed Jan 23, 2020
1 parent 7d0c9aa commit e4abe78
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
7 changes: 7 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e4abe78

Please sign in to comment.