Skip to content

Commit

Permalink
Enable node scaling functionality with asg tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Samseppiol committed Apr 23, 2020
1 parent a7083e0 commit 9cba6ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eks-cluster.cfhighlander.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ComponentParam 'InstanceType'

ComponentParam 'SpotPrice', ''

ComponentParam 'EnableScaling', 'true'
ComponentParam 'DesiredCapacity', '1'
ComponentParam 'MinSize', '1'
ComponentParam 'MaxSize', '2'
Expand Down
7 changes: 7 additions & 0 deletions eks-cluster.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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] = true }
AutoScaling_AutoScalingGroup(:EksNodeAutoScalingGroup) {
UpdatePolicy(:AutoScalingRollingUpdate, {
MaxBatchSize: '1',
Expand All @@ -193,6 +199,7 @@
LaunchTemplateId: Ref(:EksNodeLaunchTemplate),
Version: FnGetAtt(:EksNodeLaunchTemplate, :LatestVersionNumber)
})
Tags asg_tags
}


Expand Down

0 comments on commit 9cba6ea

Please sign in to comment.