Merge pull request #1277 from robgil-dds/169163334-k8s-autoscaling

169163334 - Adds autoscaling to k8s
This commit is contained in:
Jay R. Newlin (PromptWorks) 2019-12-26 10:14:57 -05:00 committed by GitHub
commit 61ae54af81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 8 deletions

View File

@ -21,6 +21,9 @@ resource "azurerm_kubernetes_cluster" "k8s" {
vnet_subnet_id = var.vnet_subnet_id
node_count = 1
enable_node_public_ip = true # Nodes need a public IP for external resources. FIXME: Switch to NAT Gateway if its available in our subscription
enable_auto_scaling = var.enable_auto_scaling
max_count = var.max_count # FIXME: if auto_scaling disabled, set to 0
min_count = var.min_count # FIXME: if auto_scaling disabled, set to 0
}
lifecycle {

View File

@ -33,3 +33,22 @@ variable "vnet_subnet_id" {
description = "Subnet to use for the default k8s pool"
type = string
}
variable "enable_auto_scaling" {
default = false
type = string
description = "Enable or disable autoscaling (Default: false)"
}
variable "max_count" {
default = 1
type = string
description = "Maximum number of nodes to use in autoscaling. This requires `enable_auto_scaling` to be set to true"
}
variable "min_count" {
default = 1
type = string
description = "Minimum number of nodes to use in autoscaling. This requires `enable_auto_scaling` to be set to true"
}

View File

@ -1,12 +1,15 @@
module "k8s" {
source = "../../modules/k8s"
region = var.region
name = var.name
environment = var.environment
owner = var.owner
k8s_dns_prefix = var.k8s_dns_prefix
k8s_node_size = var.k8s_node_size
vnet_subnet_id = module.vpc.subnets #FIXME - output from module.vpc.subnets should be map
source = "../../modules/k8s"
region = var.region
name = var.name
environment = var.environment
owner = var.owner
k8s_dns_prefix = var.k8s_dns_prefix
k8s_node_size = var.k8s_node_size
vnet_subnet_id = module.vpc.subnets #FIXME - output from module.vpc.subnets should be map
enable_auto_scaling = true
max_count = 5
min_count = 2
}
#module "main_lb" {