Skip to content

Commit 1ce3e62

Browse files
authored
Merge pull request #220 from richardmcsong/master
Add default_max_pods_per_node and max_pods_per_node after beta_cluster templating
2 parents 0fcf684 + 5bb6848 commit 1ce3e62

File tree

13 files changed

+34
-6
lines changed

13 files changed

+34
-6
lines changed

autogen/cluster_regional.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ resource "google_container_cluster" "primary" {
5959
{% if beta_cluster %}
6060
enable_binary_authorization = var.enable_binary_authorization
6161
enable_intranode_visibility = var.enable_intranode_visibility
62+
default_max_pods_per_node = var.default_max_pods_per_node
6263

6364
vertical_pod_autoscaling {
6465
enabled = var.enable_vertical_pod_autoscaling
@@ -208,6 +209,9 @@ resource "google_container_node_pool" "pools" {
208209
"initial_node_count",
209210
lookup(var.node_pools[count.index], "min_count", 1),
210211
)
212+
{% if beta_cluster %}
213+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
214+
{% endif %}
211215

212216
autoscaling {
213217
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)

autogen/cluster_zonal.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ resource "google_container_cluster" "zonal_primary" {
5555
{% if beta_cluster %}
5656
enable_binary_authorization = var.enable_binary_authorization
5757
enable_intranode_visibility = var.enable_intranode_visibility
58-
58+
default_max_pods_per_node = var.default_max_pods_per_node
59+
5960
vertical_pod_autoscaling {
6061
enabled = var.enable_vertical_pod_autoscaling
6162
}
@@ -204,7 +205,9 @@ resource "google_container_node_pool" "zonal_pools" {
204205
"initial_node_count",
205206
lookup(var.node_pools[count.index], "min_count", 1),
206207
)
207-
208+
{% if beta_cluster %}
209+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
210+
{% endif %}
208211
autoscaling {
209212
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
210213
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)

autogen/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ variable "istio" {
323323
default = false
324324
}
325325

326+
variable "default_max_pods_per_node" {
327+
description = "The maximum number of pods to schedule per node"
328+
default = 110
329+
}
330+
326331
variable "database_encryption" {
327332
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."
328333
type = list(object({state = string, key_name = string}))

cluster_zonal.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ resource "google_container_node_pool" "zonal_pools" {
142142
"initial_node_count",
143143
lookup(var.node_pools[count.index], "min_count", 1),
144144
)
145-
146145
autoscaling {
147146
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
148147
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
143143
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
144144
| 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 |
145145
| 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 |
146+
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
146147
| 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 |
147148
| description | The description of the cluster | string | `""` | no |
148149
| 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 |

modules/beta-private-cluster/cluster_regional.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ resource "google_container_cluster" "primary" {
5454

5555
enable_binary_authorization = var.enable_binary_authorization
5656
enable_intranode_visibility = var.enable_intranode_visibility
57+
default_max_pods_per_node = var.default_max_pods_per_node
5758

5859
vertical_pod_autoscaling {
5960
enabled = var.enable_vertical_pod_autoscaling
@@ -194,6 +195,7 @@ resource "google_container_node_pool" "pools" {
194195
"initial_node_count",
195196
lookup(var.node_pools[count.index], "min_count", 1),
196197
)
198+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
197199

198200
autoscaling {
199201
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)

modules/beta-private-cluster/cluster_zonal.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ resource "google_container_cluster" "zonal_primary" {
5050

5151
enable_binary_authorization = var.enable_binary_authorization
5252
enable_intranode_visibility = var.enable_intranode_visibility
53+
default_max_pods_per_node = var.default_max_pods_per_node
5354

5455
vertical_pod_autoscaling {
5556
enabled = var.enable_vertical_pod_autoscaling
@@ -190,7 +191,7 @@ resource "google_container_node_pool" "zonal_pools" {
190191
"initial_node_count",
191192
lookup(var.node_pools[count.index], "min_count", 1),
192193
)
193-
194+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
194195
autoscaling {
195196
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
196197
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)

modules/beta-private-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ variable "istio" {
320320
default = false
321321
}
322322

323+
variable "default_max_pods_per_node" {
324+
description = "The maximum number of pods to schedule per node"
325+
default = 110
326+
}
327+
323328
variable "database_encryption" {
324329
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."
325330
type = list(object({ state = string, key_name = string }))

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
138138
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
139139
| 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 |
140140
| 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 |
141+
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
141142
| description | The description of the cluster | string | `""` | no |
142143
| 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 |
143144
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |

modules/beta-public-cluster/cluster_regional.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ resource "google_container_cluster" "primary" {
5454

5555
enable_binary_authorization = var.enable_binary_authorization
5656
enable_intranode_visibility = var.enable_intranode_visibility
57+
default_max_pods_per_node = var.default_max_pods_per_node
5758

5859
vertical_pod_autoscaling {
5960
enabled = var.enable_vertical_pod_autoscaling
@@ -188,6 +189,7 @@ resource "google_container_node_pool" "pools" {
188189
"initial_node_count",
189190
lookup(var.node_pools[count.index], "min_count", 1),
190191
)
192+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
191193

192194
autoscaling {
193195
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)

modules/beta-public-cluster/cluster_zonal.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ resource "google_container_cluster" "zonal_primary" {
5050

5151
enable_binary_authorization = var.enable_binary_authorization
5252
enable_intranode_visibility = var.enable_intranode_visibility
53+
default_max_pods_per_node = var.default_max_pods_per_node
5354

5455
vertical_pod_autoscaling {
5556
enabled = var.enable_vertical_pod_autoscaling
@@ -185,7 +186,7 @@ resource "google_container_node_pool" "zonal_pools" {
185186
"initial_node_count",
186187
lookup(var.node_pools[count.index], "min_count", 1),
187188
)
188-
189+
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
189190
autoscaling {
190191
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
191192
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)

modules/beta-public-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ variable "istio" {
296296
default = false
297297
}
298298

299+
variable "default_max_pods_per_node" {
300+
description = "The maximum number of pods to schedule per node"
301+
default = 110
302+
}
303+
299304
variable "database_encryption" {
300305
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."
301306
type = list(object({ state = string, key_name = string }))

modules/private-cluster/cluster_zonal.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ resource "google_container_node_pool" "zonal_pools" {
147147
"initial_node_count",
148148
lookup(var.node_pools[count.index], "min_count", 1),
149149
)
150-
151150
autoscaling {
152151
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
153152
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)

0 commit comments

Comments
 (0)