Skip to content

Commit

Permalink
Configurable initial node count (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmiller609 authored May 6, 2020
1 parent b0bc09b commit 3942452
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
16 changes: 5 additions & 11 deletions node_pools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "google_container_node_pool" "node_pool_mt_green" {

# if we are 'regional' i.e. in 3 zones,
# "1" here means "1 in each zone"
initial_node_count = var.zonal_cluster ? "3" : "1"
initial_node_count = var.green_mt_np_initial_node_count

autoscaling {
min_node_count = "0"
Expand Down Expand Up @@ -100,12 +100,6 @@ resource "google_container_node_pool" "node_pool_mt" {

version = var.kube_version_gke

# We want the multi-tenant node pool to be completely replaced
# instead of rolling deployment.
# The master_version will ensure that the node pool is created then
# destroyed if there is an update.
name = "${var.deployment_id}-mt-${formatdate("MM-DD-hh-mm", timestamp())}"

# this one can take a long time to delete or create
timeouts {
create = "30m"
Expand All @@ -123,7 +117,7 @@ resource "google_container_node_pool" "node_pool_mt" {

# if we are 'regional' i.e. in 3 zones,
# "1" here means "1 in each zone"
initial_node_count = var.zonal_cluster ? "3" : "1"
initial_node_count = var.blue_mt_np_initial_node_count

autoscaling {
min_node_count = "0"
Expand Down Expand Up @@ -207,7 +201,7 @@ resource "google_container_node_pool" "node_pool_dynamic_pods" {

# if we are 'regional' i.e. in 3 zones,
# "1" here means "1 in each zone"
initial_node_count = var.zonal_cluster ? "3" : "1"
initial_node_count = var.dynamic_np_initial_node_count

autoscaling {
min_node_count = "0"
Expand Down Expand Up @@ -275,7 +269,7 @@ resource "google_container_node_pool" "node_pool_platform" {

# if we are 'regional' i.e. in 3 zones,
# "1" here means "1 in each zone"
initial_node_count = var.zonal_cluster ? "3" : "1"
initial_node_count = var.blue_platform_np_initial_node_count

autoscaling {
min_node_count = "1"
Expand Down Expand Up @@ -338,7 +332,7 @@ resource "google_container_node_pool" "node_pool_platform_green" {

# if we are 'regional' i.e. in 3 zones,
# "1" here means "1 in each zone"
initial_node_count = var.zonal_cluster ? "3" : "1"
initial_node_count = var.green_platform_np_initial_node_count

autoscaling {
min_node_count = "1"
Expand Down
30 changes: 30 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ variable "enable_blue_platform_node_pool" {
description = "Turn on the blue platform node pool"
}

variable "blue_platform_np_initial_node_count" {
type = number
default = 1
description = "Initial node count for the blue platform node pool"
}

variable "machine_type_platform_blue" {
default = "n1-standard-4"
type = string
Expand Down Expand Up @@ -163,6 +169,12 @@ variable "enable_green_platform_node_pool" {
description = "Turn on the green platform node pool"
}

variable "green_platform_np_initial_node_count" {
type = number
default = 1
description = "Initial node count for the green platform node pool"
}

variable "machine_type_platform_green" {
default = "n1-standard-4"
type = string
Expand Down Expand Up @@ -196,6 +208,12 @@ variable "enable_blue_mt_node_pool" {
description = "Turn on the blue multi-tenant node pool"
}

variable "blue_mt_np_initial_node_count" {
type = number
default = 1
description = "Initial node count for the blue multi-tenant node pool"
}

variable "machine_type_multi_tenant_blue" {
default = "n1-standard-4"
description = "The GCP machine type for GKE worker nodes running multi-tenant workloads"
Expand Down Expand Up @@ -232,6 +250,12 @@ variable "enable_green_mt_node_pool" {
description = "Turn on the green multi-tenant node pool"
}

variable "green_mt_np_initial_node_count" {
type = number
default = 1
description = "Initial node count for the green multi-tenant node pool"
}

variable "machine_type_multi_tenant_green" {
default = "n1-standard-4"
description = "The GCP machine type for GKE worker nodes running multi-tenant workloads"
Expand Down Expand Up @@ -268,6 +292,12 @@ variable "create_dynamic_pods_nodepool" {
description = "If true, creates a NodePool for the pods spun up using KubernetesPodsOperator or KubernetesExecutor"
}

variable "dynamic_np_initial_node_count" {
type = number
default = 1
description = "Initial node count for the dynamic node pool"
}

variable "disk_size_dynamic" {
default = 100
type = number
Expand Down

0 comments on commit 3942452

Please sign in to comment.