Skip to content

Commit

Permalink
Add the two workload_autoscaler_profile options to AKS cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
to266 committed Nov 24, 2023
1 parent 81918aa commit 9cf034d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion azurerm/_modules/aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ resource "azurerm_kubernetes_cluster" "current" {
network_plugin = var.network_plugin
network_policy = var.network_policy

docker_bridge_cidr = "172.17.0.1/16"
service_cidr = var.service_cidr
dns_service_ip = var.dns_service_ip
pod_cidr = var.network_plugin == "azure" ? null : var.pod_cidr
Expand Down Expand Up @@ -76,5 +75,10 @@ resource "azurerm_kubernetes_cluster" "current" {
}
}

workload_autoscaler_profile {
keda_enabled = var.keda_enabled
vertical_pod_autoscaler_enabled = var.vertical_pod_autoscaler_enabled
}

tags = var.metadata_labels
}
13 changes: 13 additions & 0 deletions azurerm/_modules/aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,16 @@ variable "availability_zones" {
description = "The list of availability zones to create the node pool in"
default = []
}


variable "keda_enabled" {
type = bool
description = "Whether KEDA Autoscaler should be enabled for the cluster."
default = false
}

variable "vertical_pod_autoscaler_enabled" {
type = bool
description = "Whether Vertical Pod Autoscaler should be enabled for the cluster."
default = false
}
3 changes: 3 additions & 0 deletions azurerm/cluster/configuration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ locals {
additional_metadata_labels_lookup = lookup(local.cfg, "additional_metadata_labels", "")
additional_metadata_labels_tuples = [for t in split(",", local.additional_metadata_labels_lookup) : split("=", t)]
additional_metadata_labels = { for t in local.additional_metadata_labels_tuples : t[0] => t[1] if length(t) == 2 }

keda_enabled = lookup(local.cfg, "keda_enabled", false)
vertical_pod_autoscaler_enabled = lookup(local.cfg, "vertical_pod_autoscaler_enabled", false)
}
3 changes: 3 additions & 0 deletions azurerm/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ module "cluster" {
enable_log_analytics = local.enable_log_analytics

availability_zones = local.availability_zones

keda_enabled = local.keda_enabled
vertical_pod_autoscaler_enabled = local.vertical_pod_autoscaler_enabled
}

0 comments on commit 9cf034d

Please sign in to comment.