Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(aws/loadbalancing): mark draining instances as out of service (#5060
)

* Consider draining instance as Draining, not Up
Co-authored-by: Truong <truong@b2bquotes.com>
  • Loading branch information
Truong Pham committed Nov 6, 2020
1 parent f24c3a9 commit 3dea44c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Expand Up @@ -40,20 +40,17 @@ class InstanceTargetGroupState {
private HealthState deriveHealthState() {
//ELBv2 has concrete states: unused -> initial -> healthy -> draining
// \-> unhealthy -/

// 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') {
return HealthState.OutOfService
switch (state) {
case 'healthy':
return HealthState.Up
case 'initial':
return HealthState.Starting
case 'unused':
return HealthState.OutOfService
case 'draining':
return HealthState.Draining
default:
return HealthState.Down
}
return HealthState.Down
}
}
Expand Up @@ -23,7 +23,8 @@ public enum HealthState {
Unknown,
Starting,
Succeeded,
Up;
Up,
Draining;

public static HealthState fromString(final String name) {
for (HealthState state : values()) {
Expand Down

0 comments on commit 3dea44c

Please sign in to comment.