Skip to content

Commit

Permalink
fix(aws/loadbalancing): don't mark an instance out of service until d…
Browse files Browse the repository at this point in the history
…raining completes. (#4042)

An instance in a draining state still has open connections, wait until draining
completes before marking the instance out of service.

This is consistent with CLB behaviour where an instance remains InService during
its draining period, and we still consider it to be UP as a result.
  • Loading branch information
cfieber committed Sep 18, 2019
1 parent 7876dce commit f255ee0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ class InstanceTargetGroupState {
private HealthState deriveHealthState() {
//ELBv2 has concrete states: unused -> initial -> healthy -> draining
// \-> unhealthy -/
if (state == 'healthy') {

// a draining instance is still serving active connections, and will
// transition to unused once those complete - we will consider it
// UP until it completes draining
if (state == 'healthy' || state == 'draining') {
return HealthState.Up
}

if (state == 'initial') {
return HealthState.Starting
}
if (state == 'unused' || state == 'draining') {
if (state == 'unused') {
return HealthState.OutOfService
}
return HealthState.Down
Expand Down

0 comments on commit f255ee0

Please sign in to comment.