Files
floci/tools/docs
Allen Sanborn afe26c6ad1 fix(elb): route Classic (v1) requests to a dedicated handler instead of ELBv2 (#2619)
* feat(elb): implement Classic (v1) Elastic Load Balancing

Classic ELB (2012-06-01) and ELBv2 (2015-12-01) share an endpoint host and
an `elasticloadbalancing` credential scope, but they are different APIs. Every
Classic request was reaching the ELBv2 handler, which rejected a well-formed
one with `ValidationError: Name is required for load balancer.` — because the
name arrived as `LoadBalancerName`, the Classic parameter — and answered a
request that guessed `Name` with an ALB object in the 2015-12-01 namespace, a
shape Classic has no concept of.

Route on the API version. Every Query-protocol request carries the version it
speaks as the `Version` form parameter, and both service models declare it, so
that is the discriminator: 2012-06-01 to the new Classic handler, 2015-12-01 to
ELBv2. This is the same in-case split the `rds` scope already uses to separate
RDS, Neptune and DocumentDB. Requests that omit `Version` fall back to their
parameter shape — an action unique to one API, else `LoadBalancerName` /
`LoadBalancerNames` selecting Classic, else ELBv2 as before.

Classic state is its own model, not the v2 one: keyed by name, no ARN, listeners
inline, and one structured attribute record. Responses follow the 2012-06-01
model's wrapper and element names — `CreateLoadBalancerResult` carries `DNSName`
and nothing else.

Scope is what the AWS provider drives for `aws_elb` and for an Auto Scaling
group attached to one: Create/Delete/DescribeLoadBalancers, the listener
operations, ConfigureHealthCheck, Register/DeregisterInstances,
DescribeInstanceHealth, Modify/DescribeLoadBalancerAttributes, the subnet,
availability-zone and security-group operations, and tagging. The stickiness
and backend-server policy operations, and SetLoadBalancerListenerSSLCertificate,
answer `UnsupportedOperation` in the 2012-06-01 namespace rather than a
fabricated result. There is no Classic data plane: listener ports are recorded
but no socket is opened.

Health is checked per instance from the single `HealthCheck.Target` string —
`HTTP:`/`HTTPS:` probed with a request, `TCP:`/`SSL:` by connecting — with the
same counters and thresholds ElbV2HealthChecker uses. An ASG naming Classic load
balancers in `LoadBalancerNames` now registers and deregisters its instances
with them, so a `min_elb_capacity` wait can be satisfied.

* docs(elb): register ElbClassicQueryHandler in services.yaml

Unblocks 'make docs-check', which fails on rebase without this — the
handler was never registered when the Classic ELB feature landed.

* fix(elb): register ElbClassicService for native init, deregister stale ASG instances from Classic ELBs

ElbClassicService's SecureRandom field wasn't declared under
--initialize-at-run-time, which fails GraalVM native image builds
(image-heap Random instances have cached seeds). Registers it
alongside the other services/*.Service entries in application.yml.

Also closes a gap Greptile flagged: removeStaleInstances() pruned an
ASG's dead instance references without deregistering them from target
groups or named Classic load balancers first, unlike the terminating-
and scale-in paths, leaving orphaned registrations visible through
DescribeLoadBalancers/DescribeInstanceHealth.

* fix(elb): return the documented 409 for a Classic multi-VPC subnet set

CreateLoadBalancer's own Errors table puts InvalidConfigurationRequest at HTTP
409; the Classic path raised it at 400. The error code was already right, so a
client that retries on 409 but fails hard on 400 got the wrong signal from the
one place the two can be told apart. Covered by a unit test that asserts the
status, not just the code.

Also from review: the empty-Listeners ValidationError carried a message copied
from an unrelated subnet/AZ check, and the new cross-reference to the Classic
docs page split elb.md's opening sentence mid-paragraph instead of following it.
2026-08-31 19:05:07 -04:00
..