Skip to content

Commit

Permalink
add user pool with reduced pd-ssd size
Browse files Browse the repository at this point in the history
should reduce operational costs by ~1k/month

sets autoscale-max on existing user pool to 1 to avoid allocation of new nodes.

Can delete old user pool once it's drained.
  • Loading branch information
minrk committed Jan 18, 2022
1 parent 20ef6c7 commit 3f9a0d9
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions terraform/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ resource "google_container_node_pool" "core" {

lifecycle {
ignore_changes = [
version
version
]
}
}
Expand All @@ -79,6 +79,50 @@ resource "google_container_node_pool" "user" {
node_locations = ["${local.location}-a"]
version = local.gke_version

autoscaling {
min_node_count = 0
max_node_count = 1
}


node_config {
machine_type = "n1-highmem-8"
disk_size_gb = 1000
disk_type = "pd-ssd"
local_ssd_count = 1

labels = {
"mybinder.org/pool-type" = "users"
}
# https://www.terraform.io/docs/providers/google/r/container_cluster.html#oauth_scopes-1
oauth_scopes = [
"storage-ro",
"logging-write",
"monitoring",
]

metadata = {
disable-legacy-endpoints = "true"
}
}

# do not recreate pools that have been auto-upgraded

lifecycle {
ignore_changes = [
version
]
}
}

resource "google_container_node_pool" "user1" {
name = "user-202201"
cluster = module.mybinder.cluster_name
location = local.location # location of *cluster*
# node_locations lets us specify a single-zone regional cluster:
node_locations = ["${local.location}-a"]
version = local.gke_version

autoscaling {
min_node_count = 2
max_node_count = 12
Expand All @@ -87,7 +131,7 @@ resource "google_container_node_pool" "user" {

node_config {
machine_type = "n1-highmem-8"
disk_size_gb = 1000
disk_size_gb = 500
disk_type = "pd-ssd"
local_ssd_count = 1

Expand All @@ -110,7 +154,7 @@ resource "google_container_node_pool" "user" {

lifecycle {
ignore_changes = [
version
version
]
}
}
Expand Down

0 comments on commit 3f9a0d9

Please sign in to comment.