Skip to content

Commit 5ecd582

Browse files
Lingling PengLingling Peng
authored andcommitted
add an environment variable to control if auto scaler get deployed; add a env variable in PR run in spacelift to skip it for now
1 parent fa096fb commit 5ecd582

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

modules/sage-aws-k8s-node-autoscaler/main.tf

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,8 @@ resource "helm_release" "ocean-kubernetes-controller" {
103103
}
104104
}
105105

106-
107-
# -----------patch-------------------------
108-
# --- Discover the current cluster version ---
109-
data "aws_eks_cluster" "this" {
110-
name = var.cluster_name
111-
}
112-
113-
locals {
114-
# Use var.cluster_version if set, else detect from live cluster
115-
k8s_version = coalesce(var.cluster_version, data.aws_eks_cluster.this.version)
116-
}
117-
118-
# --- Lookup recommended AL2 AMI from SSM ---
119-
data "aws_ssm_parameter" "eks_worker_ami" {
120-
name = "/aws/service/eks/optimized-ami/${local.k8s_version}/amazon-linux-2/recommended/image_id"
121-
}
122-
# -----------patch-------------------------
123-
124106
module "ocean-aws-k8s" {
107+
count = var.enable_autoscaler ? 1 : 0
125108
source = "spotinst/ocean-aws-k8s/spotinst"
126109
version = "1.4.0"
127110

modules/sage-aws-k8s-node-autoscaler/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ variable "single_az" {
5454
description = "Single AZ"
5555
type = bool
5656
}
57+
58+
variable "enable_autoscaler" {
59+
type = bool
60+
default = true
61+
}

0 commit comments

Comments
 (0)