Skip to content

Commit

Permalink
[#3599] Include the Spot instances when creating the schedule rack op…
Browse files Browse the repository at this point in the history
…tion

### What is the feature/fix?

Set the feature of scheduling the rack down/up on SpotInstances ASG, in case SpotInstanceBid is set.

### Does it has a breaking change?

No

### How to use/test it?

1. Set the [SpotInstanceBid](https://docsv2.convox.com/reference/rack-parameters#spotinstancebid)
2. Set the [ScheduleRackScaleDown & ScheduleRackScaleUp](https://docsv2.convox.com/reference/rack-parameters#schedulerackscaledown-schedulerackscaleup)
3. Check on the ASG page (AWS) if all three groups are set to 0.

### Checklist
- [ ] ~~New coverage tests~~
- [x] Unit tests passing
- [x] E2E tests passing
- [ ] ~~E2E downgrade/update test passing~~
- [ ] ~~Documentation updated~~
- [x] No warnings or errors on Deepsource/Codecov
  • Loading branch information
Twsouza authored and nightfury1204 committed Oct 26, 2022
1 parent d3ac226 commit 96c587c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions provider/aws/formation/rack.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
] },
"SpotInstances": { "Fn::Not": [ { "Fn::Equals": [ { "Ref": "SpotInstanceBid"}, "" ] } ] },
"SpotInstancesAndHA": { "Fn::And": [ { "Condition": "SpotInstances" }, { "Condition": "HighAvailability" } ] },
"SpotInstancesAndSetScheduleRack": { "Fn::And": [ { "Condition": "SpotInstances" }, { "Condition": "SetScheduleRackScale" } ] },
"SwapEnabled": { "Fn::Not": [ { "Fn::Equals": [ { "Ref": "SwapSize" }, "0" ] } ] },
"ThirdAvailabilityZone": { "Fn::And": [
{ "Fn::Equals": [ { "Fn::FindInMap": [ "RegionConfig", { "Ref": "AWS::Region" }, "ThirdAvailabilityZone" ] }, "Yes" ] },
Expand Down Expand Up @@ -1992,6 +1993,27 @@
"Recurrence": { "Ref": "ScheduleRackScaleUp" }
}
},
"SpotScheduleRackScaleDown":{
"Type":"AWS::AutoScaling::ScheduledAction",
"Condition": "SpotInstancesAndSetScheduleRack",
"Properties":{
"AutoScalingGroupName": { "Ref": "SpotInstances" },
"DesiredCapacity": "0",
"MaxSize": "0",
"MinSize": "0",
"Recurrence": { "Ref": "ScheduleRackScaleDown" }
}
},
"SpotScheduleRackScaleUp":{
"Type":"AWS::AutoScaling::ScheduledAction",
"Condition": "SpotInstancesAndSetScheduleRack",
"Properties":{
"AutoScalingGroupName": { "Ref": "SpotInstances" },
"MinSize": "0",
"MaxSize": "1000",
"Recurrence": { "Ref": "ScheduleRackScaleUp" }
}
},
"InstancesAutoscaler": {
"Type": "AWS::Lambda::Function",
"Condition": "Autoscale",
Expand Down

0 comments on commit 96c587c

Please sign in to comment.