From f255ee0a703dfa1eb9a2bead0e5e7cc17fbeaf6b Mon Sep 17 00:00:00 2001 From: Cameron Fieber Date: Wed, 18 Sep 2019 16:54:19 -0700 Subject: [PATCH] fix(aws/loadbalancing): don't mark an instance out of service until draining 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. --- .../clouddriver/aws/model/InstanceTargetGroupState.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/model/InstanceTargetGroupState.groovy b/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/model/InstanceTargetGroupState.groovy index c9fd6060c7a..c8ca4bff9d5 100644 --- a/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/model/InstanceTargetGroupState.groovy +++ b/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/model/InstanceTargetGroupState.groovy @@ -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