-
Notifications
You must be signed in to change notification settings - Fork 295
feat: support for AWS mixed instances #1531
Conversation
To support ASGs with multiple instance types purchase options, See: https://aws.amazon.com/blogs/aws/new-ec2-auto-scaling-groups-with-multiple-instance-types-purchase-options/
Codecov Report
@@ Coverage Diff @@
## master #1531 +/- ##
==========================================
+ Coverage 25.46% 25.92% +0.45%
==========================================
Files 97 98 +1
Lines 5003 5034 +31
==========================================
+ Hits 1274 1305 +31
Misses 3582 3582
Partials 147 147
Continue to review full report at Codecov.
|
/assign @mumoshu |
Autoscaler for mixedInstances is still work in progress, see: kubernetes/autoscaler#1473
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Absolutely brilliant. Please make sure to add support for spot resources in the mix as well, as this is supported by this new AWS feature. I can totally see spot fleet requests being 100% replaced by AutoScaling using a launch template. EDIT |
"SpotAllocationStrategy" : "{{.AutoScalingGroup.MixedInstances.SpotAllocationStrategy}}", | ||
{{end}} | ||
"SpotInstancePools" : {{.AutoScalingGroup.MixedInstances.SpotInstancePools}}, | ||
"SpotMaxPrice" : "{{.AutoScalingGroup.MixedInstances.SpotMaxPrice}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpotMaxPrice should be possible to leave out. If you are excluding SpotMaxPrice in the policy AWS will automatically set the on demand price as max price. This is especially important when having an override list of mixed instance types and sizes.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-instancesdistribution.html#cfn-as-mixedinstancespolicy-spotmaxprice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that you add
{{if .AutoScalingGroup.MixedInstances.SpotMaxPrice}}
"SpotMaxPrice" : "{{.AutoScalingGroup.MixedInstances.SpotMaxPrice}}"
{{end}}
Please have a look at my comment |
What will happen when this change is rolled into existing clusters? |
For what I understand a Launch Configuration will be replaced by a Launch template, and if you don't specify AutoScalingGroup.MixedInstances.Enabled or AutoScalingGroup.MixedInstances at all, the AutoScaling group should just do a rolling update of all nodes. The author @koen92 might have additional insight. |
As the co-author of this pr; @paalkr Good one, we will change this. |
@paalkr Fixed it! |
Thx @koen92 According to the CloudFormation AutoScalingGroup documentation, changing either the LaunchTemplate or the LaunchConfiguration requires no interruption. |
Btw, I have tested using a Mixed Instance Policy with 100% spot resources, and an instance distribution and instance type mix (overrides), that simulates my currently running worker pool powered by a regular spotfleet (40+ nodes). When changing something in the LaunchTemplate that will issue a rolling update (like AMI ID or user data), the AutoScaling group nicely performs a rolling update of the spot resources - one by one. This actually solves a huge nightmare of how AWS spot fleet currently are handled. Where a change to a spot fleet request, replaces all spot instances in a one shot operation. I can't see any situation where the old spot fleets are preferable over this new mixed instance policy with overrides. |
Just confirmed that cloudformation is doing a nice rolling update moving from launchconfiguration to launchtemplate. Seeing is believing, always nice if the docs are right ;). @davidmccormick can you also approve this pr? have not seen a reaction @mumoshu recently. |
Thank you for your contribution - good work! 🎉 |
AWS recently introduced the option of using autoscalinggroups and combine multiple instances.
https://aws.amazon.com/blogs/aws/new-ec2-auto-scaling-groups-with-multiple-instance-types-purchase-options/
This PR changes the CF LaunchConfiguration templates into CF LaunchTemplates, which will add the ability to combine multiple instance types within an AutoScalingGroup.
Please let me know what you think about this! (since it's quite a refactor in the CF node pool template).
Related issue: #1500