Skip to content

Commit

Permalink
fix: add variables to autoscaling parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sydrawat01 committed Nov 23, 2023
1 parent 012defa commit 2ff2518
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/k8s/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ resource "google_container_node_pool" "gke_linux_node_pool" {
node_count = 1

autoscaling {
max_node_count = 2 # change to 6
min_node_count = 1 # change to 3
max_node_count = var.max_node_count # change to 6
min_node_count = var.min_node_count # change to 3
}

management {
Expand Down
2 changes: 2 additions & 0 deletions modules/k8s/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ variable "region" {}
variable "project_id" {}
variable "account_id_kubernetes" {}
variable "initial_node_count" {}
variable "max_node_count" {}
variable "min_node_count" {}
variable "node_zones" {}
variable "master_ipv4_cidr_block" {}
variable "authorized_ipv4_cidr_block" {}
Expand Down
2 changes: 2 additions & 0 deletions root/example.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS"
nat_ip_allocate_strategy = "MANUAL_ONLY"
account_id_kubernetes = ""
initial_node_count = 1
max_node_count = 2
min_node_count = 1
node_zones = ["", ""]
2 changes: 2 additions & 0 deletions root/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ module "k8s" {
region = var.region
account_id_kubernetes = var.account_id_kubernetes
initial_node_count = var.initial_node_count
max_node_count = var.max_node_count
min_node_count = var.min_node_count
node_zones = var.node_zones
master_ipv4_cidr_block = var.cluster_master_ip_cidr_range
pods_ipv4_cidr_block = var.cluster_pods_ip_cidr_range
Expand Down
10 changes: 10 additions & 0 deletions root/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ variable "cluster_services_ip_cidr_range" {
type = string
description = "The CIDR range to use for Kubernetes cluster services"
}

variable "max_node_count" {
type = number
description = "The max node count when autoscaling the cluster"
}

variable "min_node_count" {
type = number
description = "THe min node count when autoscaling the cluster"
}

0 comments on commit 2ff2518

Please sign in to comment.