Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/event based instance replacement #434

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
719ad73
Allow flavor to be customised (#359)
Aug 20, 2019
2ad0e99
fix typo (#360)
codenoid Aug 20, 2019
89a188c
Fix typo (#361)
Aug 20, 2019
4382e90
UserData wrappers for CloudFormation helper scripts when using Beanst…
jawadst Oct 11, 2019
d078902
Bring Go to 1.13 (#367)
gliptak Nov 7, 2019
b6e040e
merge with master
mello7tre Nov 19, 2019
a33cc2c
merge fixes
mello7tre Nov 19, 2019
900568a
Begin - port regional CloudFormation stack changes to the main templa…
mello7tre Nov 19, 2019
1c854e0
Merge fix
mello7tre Nov 20, 2019
2784995
Fix to template
mello7tre Nov 20, 2019
168e97a
Multiple fixes to handle lambda concurrency
mello7tre Nov 26, 2019
0cc82a1
Removed commented code
mello7tre Nov 26, 2019
a1350fc
Begin working on:
mello7tre Nov 27, 2019
a0ae84b
Progress #354
mello7tre Nov 27, 2019
d8261a2
Progress #354
mello7tre Nov 28, 2019
3a6fd0a
Progress #354
mello7tre Nov 29, 2019
1a53041
Progress #354
mello7tre Nov 29, 2019
68b8338
Progress #354
mello7tre Dec 2, 2019
40224d7
Progress #354
mello7tre Dec 3, 2019
1899417
* Use inline python lambda to increase ASG
mello7tre Dec 6, 2019
f102241
* Use inline python lambda to increase ASG
mello7tre Dec 8, 2019
1d395bc
* Use inline python lambda to increase ASG
mello7tre Dec 9, 2019
36e82a8
* Improvements on event based instance replacement
mello7tre Dec 10, 2019
63ba2b2
* Improvements on event based instance replacement
mello7tre Dec 30, 2019
d49a0d3
* Improvements on event based instance replacement
mello7tre Dec 30, 2019
476ba58
* Improvements on event based instance replacement
mello7tre Dec 31, 2019
1f358a6
* Improvements on event based instance replacement
mello7tre Jan 2, 2020
621bb79
* Improvements on event based instance replacement
mello7tre Jan 2, 2020
2edb1a1
* Improvements on event based instance replacement
mello7tre Jan 2, 2020
6a137cc
* gofmt cosmetic changes
mello7tre Jan 2, 2020
83c474c
Fix to rand.Intn parameter to include even 9
mello7tre Jan 2, 2020
a00efde
fix terminateRandomSpotInstanceIfHavingEnough
mello7tre Mar 31, 2020
c93bffd
fix terminateRandomSpotInstanceIfHavingEnough
mello7tre Mar 31, 2020
1c26c6c
fix terminateRandomSpotInstanceIfHavingEnough
mello7tre Mar 31, 2020
073c636
Specify/override multiplier for the on-demand price on a group
mello7tre Apr 1, 2020
b8a4a1e
Specify/override multiplier for the on-demand price on a group
mello7tre Apr 1, 2020
56e03d7
Merge remote-tracking branch 'upstream/feat/event-based-instance-repl…
mello7tre Apr 2, 2020
ae8f29b
Misc fixes to be able to run go tests
mello7tre Apr 3, 2020
b3d0daa
Misc fixes to be able to run go tests - continue
mello7tre Apr 3, 2020
2fbf9e0
Misc fixes to be able to run go tests - end for now
mello7tre Apr 3, 2020
582c525
For Test_autoScalingGroup_terminateRandomSpotInstanceIfHavingEnough
mello7tre Apr 3, 2020
647337e
Merge Updating AWS SDK to latest version - [0ee95c8]
mello7tre Jul 8, 2020
e771de7
Merge Relicense to OSL-3 - [972bc61]
mello7tre Jul 8, 2020
8d83a91
Merge Update readme, mention the relicensing to OSL-3 - [9b438dc]
mello7tre Jul 8, 2020
7a57534
Merge Fix `make archive` on macOS [c929391]
mello7tre Jul 8, 2020
a0778fa
Merge Move some logs to debug [fa0c27b]
mello7tre Jul 8, 2020
2ef762d
Merge Delete old Gopkg files [5504e34]
mello7tre Jul 8, 2020
036b91e
Merge Update dependencies [0e14a7b]
mello7tre Jul 8, 2020
8ff296e
Merge Support spot price buffer percentage of 0 [26ca955]
mello7tre Jul 8, 2020
3fdab5b
Merge Don't segfault when spot instance doesn't belong to ASG [f313c6d]
mello7tre Jul 8, 2020
a641137
Merge Allow specifying GOOS and GOARCH [8d67d6e]
mello7tre Jul 8, 2020
56f05f0
Merge Use /bin/bash for shell [0eed8cd]
mello7tre Jul 8, 2020
9135a45
Merge Ignore terminating spot instances that don't belong to
mello7tre Jul 8, 2020
f20ad02
Merge Revert Use /bin/bash for shell [6e45440]
mello7tre Jul 8, 2020
71820f8
Merge Pass --abort-on-container-exit to docker-compose [8f90fba]
mello7tre Jul 8, 2020
5bae2d5
Merge Rename travisci make targets to ci [2d76a9a]
mello7tre Jul 8, 2020
a086398
Merge Create FUNDING.yml + Update FUNDING.yml [dde6d85,ca81828]
mello7tre Jul 8, 2020
83e4396
Merge Use paginated version of DescribeSpotPriceHistory [9a770b3]
mello7tre Jul 8, 2020
3f849fb
Merge Delete DescribeSecurityGroups mock [3bfd542]
mello7tre Jul 8, 2020
13eba5b
Merge Move config loading out of main and add tests for it [30a4392]
mello7tre Jul 8, 2020
b83f6fd
Fixes to Merge Move config loading out of main and add tests for it
mello7tre Jul 9, 2020
acfa8ad
Merge Move logs about incompatible instance types to debug [985d675]
mello7tre Jul 9, 2020
b5ade8b
Merge Remove incorrect Makefile conditionals [a01ee26]
mello7tre Jul 9, 2020
80cfa8b
Merge Actually fail the build if gofmt fails [c391d69]
mello7tre Jul 9, 2020
eefe516
Merge Add tools to go.mod [8a9a90b]
mello7tre Jul 9, 2020
42d3c71
Merge No longer enforce the name of the ElasticBeanstalk IAM policy […
mello7tre Jul 9, 2020
6de9c2e
Merge Added spot premium [ecf31a5]
mello7tre Jul 9, 2020
8cc90f7
Merge Update how bid price is calculated for premium instances [8d13fb0]
mello7tre Jul 9, 2020
bcdf509
Merge Update dependencies [caf373d]
mello7tre Jul 9, 2020
165ce0e
Merge Cron timezone [8e04942]
mello7tre Jul 9, 2020
cb05c6f
Merge Spleling [a37aafc]
mello7tre Jul 9, 2020
8907710
Merge Update README.md [0109a0b,fb15aa4,4e03db7]
mello7tre Jul 9, 2020
c9c3ff1
Merge Use the larger of min-OD-instances and (min-OD-percent * current)
mello7tre Jul 9, 2020
742e011
gofmt changes
mello7tre Jul 9, 2020
af6ccfc
cronEventAction - fix to logic
mello7tre Jul 28, 2020
a6e9bbb
Merge branch 'feat/event-based-instance-replacement' into feat/event-…
mello7tre Jul 29, 2020
f9fb38f
merge
mello7tre Aug 10, 2020
25a42c1
merge
mello7tre Aug 10, 2020
cca4004
terminateUnneededSpotInstance - no need to call
mello7tre Aug 10, 2020
0df1be3
terminateInstanceInAutoScalingGroup is used for spot too
mello7tre Aug 10, 2020
557a0fb
Avoid adding instance in Terminating Lifecycle State
mello7tre Aug 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autospotting.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ func init() {
// Handler implements the AWS Lambda handler interface
func Handler(ctx context.Context, rawEvent json.RawMessage) {
eventHandler(&rawEvent)
}
}
1 change: 0 additions & 1 deletion core/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func (tusi terminateUnneededSpotInstance) run() {
spotInstance := tusi.target.spotInstance
spotInstanceID := *spotInstance.InstanceId

asg.terminateRandomSpotInstanceIfHavingEnough(total, true)
logger.Println("Spot instance", spotInstanceID, "is not need anymore by ASG",
asg.name, "terminating the spot instance.")
spotInstance.terminate()
Expand Down
9 changes: 7 additions & 2 deletions core/autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ func (a *autoScalingGroup) scanInstances() instances {
i.price = i.typeInfo.pricing.onDemand + i.typeInfo.pricing.premium
}

// Avoid adding instance in Terminating (Wait|Proceed) Lifecycle State
if strings.HasPrefix(*inst.LifecycleState, "Terminating"){
continue
}

a.instances.add(i)
}
return a.instances
Expand Down Expand Up @@ -717,7 +722,7 @@ func (a *autoScalingGroup) detachAndTerminateOnDemandInstance(
return a.region.instances.get(*instanceID).terminate()
}

// Terminates an on-demand instance from the group using the
// Terminates an instance from the group using the
// TerminateInstanceInAutoScalingGroup api call.
func (a *autoScalingGroup) terminateInstanceInAutoScalingGroup(
instanceID *string, wait bool, decreaseCapacity bool) error {
Expand All @@ -734,7 +739,7 @@ func (a *autoScalingGroup) terminateInstanceInAutoScalingGroup(
}

if err = a.waitForInstanceStatus(instanceID, "InService", 5); err != nil {
logger.Printf("OnDemand instance %v is still not InService, trying to terminate it anyway.",
logger.Printf("Instance %v is still not InService, trying to terminate it anyway.",
*instanceID)
}
}
Expand Down