Skip to content

Commit

Permalink
Changes due to migrating autoscaler here.
Browse files Browse the repository at this point in the history
  • Loading branch information
zawac002 committed Sep 26, 2023
1 parent 4d6d41f commit 9c00be5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
11 changes: 3 additions & 8 deletions cluster_autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {
"k8s.io/cluster-autoscaler/enabled" = "TRUE"
}

ng_asg_name = module.cluster.eks_managed_node_groups["node_group"].node_group_resources[0].autoscaling_groups[0].name
ng_asg_name = var.eks_managed_node_groups_autoscaling_group_names[0]
}

module "cluster_autoscaler_irsa_role" {
Expand All @@ -15,11 +15,11 @@ module "cluster_autoscaler_irsa_role" {

attach_cluster_autoscaler_policy = true

cluster_autoscaler_cluster_names = [module.cluster.cluster_name]
cluster_autoscaler_cluster_names = [var.cluster_name]

oidc_providers = {
main = {
provider_arn = module.cluster.oidc_provider_arn
provider_arn = var.oidc_provider_arn
namespace_service_accounts = ["kube-system:cluster-autoscaler"]
}
}
Expand All @@ -36,10 +36,6 @@ resource "aws_autoscaling_group_tag" "on-demand" {
}

data "kubernetes_namespace" "kube-system" {
depends_on = [
module.cluster.eks_managed_node_groups,
]

metadata {
name = "kube-system"
}
Expand All @@ -48,7 +44,6 @@ data "kubernetes_namespace" "kube-system" {
resource "helm_release" "cluster-autoscaler" {
depends_on = [
module.images,
module.cluster.eks_managed_node_groups,
]

chart = "cluster-autoscaler"
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ locals {
"boc:created_by" = "terraform"
CostAllocation = var.tag_costallocation
}

tags = merge(local.base_tags, var.tags)
}

resource "kubernetes_storage_class" "gp3_encrypted" {
Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ variable "security_group_all_worker_mgmt_id" {
type = string
}

variable "eks_managed_node_groups_autoscaling_group_names" {
description = "List of the autoscaling group names created by EKS managed node groups"
type = list(string)
}

variable "oidc_provider_arn" {
description = "The ARN of the OIDC Provider if `enable_irsa = true`"
type = string
}

variable "tag_costallocation" {
description = "Tag CostAllocation (default)"
type = string
Expand Down

0 comments on commit 9c00be5

Please sign in to comment.