Skip to content

feat(agent): register and promote under every protocol key (037 Phase 2, Release B part 2) - #893

Merged
bpalermo merged 1 commit into
mainfrom
feat/037-phase2b-dual-registration
Sep 21, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/037-phase2b-dual-registration

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Proposal 037 Phase 2, Release B part 2. Follows #892 (part 1, merged).

A pod serving both an HTTP and a raw-TCP port must appear in both registry listings. Part 1 taught the endpoint to carry per-port protocols; this makes the key set follow.

What changed

NewServiceEndpointFromCNIPod now returns the set of keys a pod belongs under, derived from port_protocols rather than from the pod-level annotation.

Every pod written before this proposal holds exactly one key — an unsuffixed port inherits the pod-level endpoint.aether.io/protocol — so the slice is one-element and all four call sites behave exactly as before.

All four follow: registration (pod.go), drain-marking and the delayed pool close (termination.go), health promotion (liveness.go), and the ghost sweep (ghostsweep.go). They share one helper, registerUnderAll, so the semantics are stated once rather than four times.

Risk 5, and why the helper's return value matters

Two properties it guarantees:

  • It does not stop at the first error. One key failing must not skip the others — the rest can still be brought up to date, and the retry has less to do.
  • It reports a partial failure as a failure. A registry does not reject a half-written dual-protocol pod, so nothing but this return value separates "both keys updated" from "one updated, the other silently stale".

The promotion path is where that becomes permanent. It records the transition on success, and the next tick then sees prev == want and never retries — so the other listing's endpoint stays UNHEALTHY forever, with no error raised anywhere and a cluster that merely looks like a service with no pods.

One deadline, not one per key

Callers pass a single context covering all writes. Several of these run with lifecycleMu held (S20, #772), where a per-key timeout would let a dual-protocol pod multiply the worst-case lock hold that the bound exists to cap.

Negative control

With the helper writing only the first key — which is both the pre-037 behaviour and the exact shape of Risk 5 — the two dual-key subtests fail:

--- FAIL: .../success_writes_BOTH_keys_and_records_the_transition
--- FAIL: .../a_partial_failure_must_NOT_record_the_transition

and the single-protocol subtest still passes, because that path is unchanged. That third case is the one that matters for confidence in the rollout: it is every pod on the cluster today.

bazel build //... clean, 57 tests pass, lint clean. registerUnderAll was extracted partly because inlining the loop at four sites pushed //agent/internal/cni/server past the gocognit threshold — consolidating was the better fix anyway.

Still to come in Release B

The agent data plane: destination_port-qualified capture chains from a cache-derived map, per-port tcp:<fqdn>:<p> clusters with SNI, per-port inbound floor chains, the 421 vhost, the scoped-mode blackhole chain, the #877 WARN, and the workload-requirements.md rewrite. That part carries the listener-drain risk (Risk 4) and is where 18082 stops being inert.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

… 2, Release B part 2)

A pod that serves both an HTTP and a raw-TCP port must appear in BOTH registry
listings. Part 1 taught the endpoint to carry per-port protocols; this makes
the key set follow.

NewServiceEndpointFromCNIPod now returns the SET of keys a pod belongs under,
derived from port_protocols rather than from the pod-level annotation. Every
pod written before proposal 037 holds exactly one key -- an unsuffixed port
inherits the pod-level endpoint.aether.io/protocol -- so the slice is
one-element and all four call sites behave exactly as before.

All four follow: registration (pod.go), drain-marking and the delayed pool
close (termination.go), health promotion (liveness.go) and the ghost sweep
(ghostsweep.go). They share one helper, registerUnderAll, so the semantics are
stated once rather than four times.

Two properties that helper guarantees, both load-bearing:

  - It does not stop at the first error. One key failing must not skip the
    others: the rest can still be brought up to date and the retry has less
    to do.
  - It reports a PARTIAL failure as a failure. This is 037 Risk 5. A registry
    does not reject a half-written dual-protocol pod, so nothing but this
    return value separates "both keys updated" from "one updated, the other
    silently stale". The promotion path is where that turns permanent: it
    records the transition on success, and the next tick then sees prev ==
    want and never retries -- the other listing's endpoint stays UNHEALTHY
    forever, with no error anywhere and a cluster that merely looks empty of
    pods.

Callers pass ONE deadline covering all writes, never one per key: several of
these run with lifecycleMu held (S20, #772), where a per-key timeout would let
a dual-protocol pod multiply the worst-case lock hold that bound exists to cap.

Negative control: with the helper writing only the first key -- which is both
the pre-037 behaviour and the exact shape of Risk 5 -- the two dual-key
subtests fail and the single-protocol subtest still passes, since that path is
unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit cfb0302 into main Sep 21, 2026
50 of 58 checks passed
@bpalermo
bpalermo deleted the feat/037-phase2b-dual-registration branch September 21, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant