Description
Is your feature request related to a problem? Please describe.
Very similar to #16 (but in the opposite direction), how can we ensure that instances that are in the process of terminating (or very recently terminated) do not get served any requests? I'd like to solve the race condition described by the diagram below.
NGINX Instance A AWS
| health check | |
------------------> |
| | |
| ok | |
<------------------ |
| | scale in |
| <------------------
| | *transition to |
| | "Terminating" |
| | |
| HTTP request | |
------------------> |
| | |
| times out | |
X <------------------ |
| | |
| | |
| health check | |
------------------> |
| | |
| bad | |
<------------------ |
| *mark A |
| as unhealthy |
| |
| |
| get current ASG state |
------------------------------------>
| |
| instance A has terminated |
<-----------------------------------|
| *remove A from |
| ASG upstream group |
Describe the solution you'd like
I'd like GetPrivateIPsForScalingGroup
to optionally filter out instances (controlled by a remove_terminating
config flag) that are in a state of Terminating
, Terminating:Wait
, Terminating:Proceed
, or Terminated
per this life cycle chart:
Source: https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html
In the API, I believe these map to some combination of instance states of Unfortunately, these life cycle states do not cleanly map to the instance states returned by shutting-down
, terminated
, stopping
, and stopped
.describe-instances
.
Describe alternatives you've considered
Custom script on our deploy instances that remove themselves from the NGINX upstream group via the NGINX API.