FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit f8c32143 authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

Merge branch '10-add-node-autoscaling' into 'master'

Add node autoscaling

Closes #10

See merge request !12
parents c1a7d54a 118ff3ff
No related branches found
No related tags found
Loading
Pipeline #29027 passed
......@@ -97,8 +97,9 @@ resource "google_container_node_pool" "cluster-pool-1" {
name = "pool-1"
cluster = google_container_cluster.cluster.name
# Not used if autoscaling specified.
# Note that this is multiplied by the number of zones in the region.
node_count = 1
node_count = var.autoscaling != null ? null : var.node_count
management {
auto_repair = true
......@@ -124,6 +125,14 @@ resource "google_container_node_pool" "cluster-pool-1" {
"https://www.googleapis.com/auth/monitoring",
]
}
dynamic "autoscaling" {
for_each = var.autoscaling != null ? [var.autoscaling] : []
content {
min_node_count = autoscaling.value.min_node_count
max_node_count = autoscaling.value.max_node_count
}
}
}
# kubeconfig-style configuration
......@@ -138,4 +147,3 @@ data "template_file" "kubeconfig" {
endpoint = google_container_cluster.cluster.endpoint
}
}
......@@ -70,3 +70,19 @@ variable "disk_type" {
description = "Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd')"
}
variable "node_count" {
default = 1
description = "Number of nodes per zone"
}
variable "autoscaling" {
default = null
description = <<EOI
Minimum and maximum nodes per zone when autoscaling. For example: {min_node_count = 1, max_node_count = 3}
EOI
type = object({
min_node_count = number
max_node_count = number
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment