fix(elbv2): route only to healthy targets while any target is healthy (#8452)

An ALB routed to targets still in the initial state beside healthy ones,
so a newly registered target that was not ready took requests before its
first health check passed. While a target group has a healthy target,
the proxy now routes only to its healthy targets; when none is healthy it
still fails open to every registered target, matching the ALB guide's
"Before a target can receive requests from the load balancer, it must
pass the initial health checks". The integration tests share their
target group and health state helpers.

Closes #8451
This commit is contained in:
Maxence LEFEBVRE authored and GitHub committed 2026-11-15 10:58:44 -04:00
1 parent 4fc41cc683
commit f930634fa8
3 files changed
+94 -28

No files matched your search

@@ -154,8 +154,7 @@ public class ElbV2HealthChecker implements Resettable {
}
public boolean isHealthy(String tgArn, TargetDescription target, int port) {
String state = getState(tgArn, target.getId(), port);
return "healthy".equals(state) || "initial".equals(state);
return "healthy".equals(getState(tgArn, target.getId(), port));
}
void probeAll(String tgArn, TargetGroup tg) {