diff --git a/eks-cluster.cfhighlander.rb b/eks-cluster.cfhighlander.rb index 4c6b040..4edc6f3 100644 --- a/eks-cluster.cfhighlander.rb +++ b/eks-cluster.cfhighlander.rb @@ -14,7 +14,7 @@ ComponentParam 'InstanceType' ComponentParam 'SpotPrice', '' - + ComponentParam 'EnableScaling', 'true' ComponentParam 'DesiredCapacity', '1' ComponentParam 'MinSize', '1' ComponentParam 'MaxSize', '2' diff --git a/eks-cluster.cfndsl.rb b/eks-cluster.cfndsl.rb index 675322b..fc0cdd4 100644 --- a/eks-cluster.cfndsl.rb +++ b/eks-cluster.cfndsl.rb @@ -178,6 +178,12 @@ LaunchTemplateData(template_data) } + asg_tags = [ + { Key: FnSub("k8s.io/cluster/${EksCluster}"), Value: 'owned' }, + { Key: 'k8s.io/cluster-autoscaler/enabled', Value: Ref('EnableScaling') } + ] + asg_tags += tags + asg_tags.each {|tag| tag[:PropagateAtLaunch] = false } AutoScaling_AutoScalingGroup(:EksNodeAutoScalingGroup) { UpdatePolicy(:AutoScalingRollingUpdate, { MaxBatchSize: '1', @@ -193,6 +199,7 @@ LaunchTemplateId: Ref(:EksNodeLaunchTemplate), Version: FnGetAtt(:EksNodeLaunchTemplate, :LatestVersionNumber) }) + Tags asg_tags }