Skip to content

Commit

Permalink
Merge pull request terraform-google-modules#220 from richardmcsong/ma…
Browse files Browse the repository at this point in the history
…ster

Add default_max_pods_per_node and max_pods_per_node after beta_cluster templating
  • Loading branch information
morgante authored Aug 1, 2019
2 parents c5f7e89 + 91cf46e commit fd4839c
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 6 deletions.
4 changes: 4 additions & 0 deletions autogen/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "google_container_cluster" "primary" {
{% if beta_cluster %}
enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility
default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
Expand Down Expand Up @@ -208,6 +209,9 @@ resource "google_container_node_pool" "pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)
{% if beta_cluster %}
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
{% endif %}

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
Expand Down
7 changes: 5 additions & 2 deletions autogen/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ resource "google_container_cluster" "zonal_primary" {
{% if beta_cluster %}
enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility

default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
}
Expand Down Expand Up @@ -204,7 +205,9 @@ resource "google_container_node_pool" "zonal_pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)

{% if beta_cluster %}
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
{% endif %}
autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
Expand Down
5 changes: 5 additions & 0 deletions autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ variable "istio" {
default = false
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({state = string, key_name = string}))
Expand Down
1 change: 0 additions & 1 deletion cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ resource "google_container_node_pool" "zonal_pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
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 @@ -143,6 +143,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | bool | `"false"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "google_container_cluster" "primary" {

enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility
default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
Expand Down Expand Up @@ -194,6 +195,7 @@ resource "google_container_node_pool" "pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
Expand Down
3 changes: 2 additions & 1 deletion modules/beta-private-cluster/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ resource "google_container_cluster" "zonal_primary" {

enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility
default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
Expand Down Expand Up @@ -190,7 +191,7 @@ resource "google_container_node_pool" "zonal_pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)

max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ variable "istio" {
default = false
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
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 @@ -138,6 +138,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "google_container_cluster" "primary" {

enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility
default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
Expand Down Expand Up @@ -188,6 +189,7 @@ resource "google_container_node_pool" "pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
Expand Down
3 changes: 2 additions & 1 deletion modules/beta-public-cluster/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ resource "google_container_cluster" "zonal_primary" {

enable_binary_authorization = var.enable_binary_authorization
enable_intranode_visibility = var.enable_intranode_visibility
default_max_pods_per_node = var.default_max_pods_per_node

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
Expand Down Expand Up @@ -185,7 +186,7 @@ resource "google_container_node_pool" "zonal_pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)

max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ variable "istio" {
default = false
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
1 change: 0 additions & 1 deletion modules/private-cluster/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ resource "google_container_node_pool" "zonal_pools" {
"initial_node_count",
lookup(var.node_pools[count.index], "min_count", 1),
)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
Expand Down

0 comments on commit fd4839c

Please sign in to comment.