Skip to content

ci(conformance): MESH-HTTP (east-west GAMMA) job + cleartext mesh for SPIRE-off - #421

Merged
bpalermo merged 1 commit into
mainfrom
worktree-agent-a33706b1f5b6d5a46
Jun 28, 2026
Merged

bpalermo merged 1 commit into
mainfrom
worktree-agent-a33706b1f5b6d5a46

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

What

Extends the now-green GATEWAY-HTTP conformance CI to the MESH-HTTP (east-west GAMMA) profile, and unblocks aether's mesh data path on kind by adding a cleartext mesh mode for SPIRE-off.

Why the mesh path needed a code change (honest finding)

GATEWAY-HTTP is edge-only and never touches the mesh data path. MESH-HTTP does. The CI installs aether with spire.enabled=false (no SVIDs). I traced the SPIRE-off behavior end to end:

  • Outbound service/mesh clusters already degrade to cleartext when no node SVID is set (clustersEndpointsAndVhosts injects the per-source mTLS transport socket only when nodeSpiffeID != "").
  • Inbound (:15008), however, unconditionally terminated mTLS via an SDS-backed DownstreamTransportSocket on every filter chain. With SPIRE off the bridge never delivers SDS secrets, so the inbound listener never warmed → the mesh hop could not complete. The mesh path was structurally mTLS-only and would not route cleartext.

So a real (contained) data-plane change was required — there was no existing cleartext degradation. Per the task's guidance to prefer a cleartext mode over forcing SPIRE on kind, this adds one.

Changes

Cleartext mesh inbound (SPIRE off)

  • SnapshotCache.SetSpireEnabled (default true = production mTLS), threaded into GenerateListenersFromRegistryPod / NewInboundListener.
  • When SPIRE is off, the inbound listener is a single default HCM chain: no transport socket, AUTO codec (handles cleartext h2c from the source proxy and HTTP/1), no XFCC (no verified peer). Symmetric with the already-cleartext outbound. Production posture unchanged.
  • Unit test TestNewInboundListenerCleartext; offline gate covers it via a new cleartext node bootstrap in //test/envoy_validate (envoy --mode validate accepts it).

MESH-HTTP CI job (mesh-http)

  • Mirrors gateway-http but installs the mesh path on (agent.gamma=true, agent.captureRedirectAll=true; transparent capture / mesh Services / namespace injection are chart defaults) with SPIRE off.
  • Gates on the agent DaemonSet + registrar + controller, then runs TestAetherMeshHTTP. Soft (continue-on-error) until green; the GATEWAY-HTTP hard gate is untouched. Own kind cluster so the jobs don't collide.

Harness exec-timing race fix

  • The gateway-api mesh suite drives requests by kubectl exec-ing the echo client into backend pods; redirect-all capture adds ~15-18s of CNI latency, so the default 60s MaxTimeToConsistency can expire before pods are Ready (container not found → spurious 0-pass — a harness artifact, not a routing bug).
  • Fixed harness-side: aetherMeshTimeouts() raises MaxTimeToConsistency to 300s, and prewarmNamespaces waits the conformance pods Ready after Setup and before Run. The runner records per-test outcomes in the report (always uploaded) and no longer fails on a Run error, so the real per-test score is always emitted.

Validation

  • Runner compile-checked against gateway-api v1.5.1 (go vet -tags conformance) in a real checkout.
  • Full agent test suite green (23/23 targets); //test/envoy_validate green including the new cleartext bootstrap; go vet + format + gazelle clean.
  • Not yet run end-to-end: MESH-HTTP via workflow_dispatch only works once the workflow is on the default branch. Trigger it after merge to get the real per-test score (job is soft, so it can't break CI).

Score

Reported once the job runs post-merge (the report artifact + per-test logs are uploaded every run). Proposal 023 M1+M2 (route-by-Service) is shipped, so the load-bearing GAMMA tests (Matching/Weight/RequestHeaderModifier/RedirectHostAndStatus) are expected to exercise the real route-target → backend path; remaining gaps will be triaged from the report.

🤖 Generated with Claude Code

… SPIRE-off

Extends the conformance CI to the MESH-HTTP profile, exercising aether's mesh
data path on kind (the GATEWAY-HTTP job was edge-only and never touched it).

Cleartext mesh (SPIRE off): the per-pod inbound listener (:15008) unconditionally
terminated mTLS via an SDS-backed downstream transport socket, while the outbound
service clusters already degrade to cleartext when no node SVID is set. With SPIRE
off no SVID/SDS is delivered, so inbound never warmed and the mesh hop could not
complete — the path was structurally mTLS-only. This adds a cleartext inbound mode
(SnapshotCache.SetSpireEnabled, threaded into GenerateListenersFromRegistryPod /
NewInboundListener): when SPIRE is disabled the inbound listener is a single
default HCM chain with no transport socket, AUTO codec (handles cleartext h2c and
HTTP/1), and no XFCC — symmetric with the cleartext outbound. The mesh now routes
without SPIRE, which is what MESH-HTTP needs on kind (the suite asserts routing
correctness, not mTLS). Production keeps per-pod mTLS (default spireEnabled=true).

CI job (mesh-http): mirrors gateway-http but installs aether with the mesh path on
(agent.gamma=true, agent.captureRedirectAll=true; transparentCapture / mesh
Services / namespace injection are chart defaults) and SPIRE off, gates on the
agent DaemonSet + registrar + controller, then runs TestAetherMeshHTTP. Soft
(continue-on-error) until the score is green; the GATEWAY-HTTP hard gate is
unchanged. Runs in its own kind cluster so the jobs don't collide.

Harness exec-timing race: the gateway-api mesh suite drives requests by
kubectl-exec'ing the echo client into backend pods; redirect-all capture adds
~15-18s of CNI latency, so the default 60s MaxTimeToConsistency can expire before
pods are Ready (`container not found` → spurious 0-pass). Fixed harness-side:
aetherMeshTimeouts() raises MaxTimeToConsistency to 300s, and prewarmNamespaces
waits the conformance pods Ready after Setup and before Run. The runner records
per-test outcomes in the report (always uploaded) and no longer fails the test on
a Run error, so the real per-test score is always emitted.

Offline gate: adds a cleartext node bootstrap to //test/envoy_validate so
`envoy --mode validate` covers the SPIRE-off inbound config. Runner compile-checked
against gateway-api v1.5.1 (go vet -tags conformance); full agent suite green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
@bpalermo
bpalermo merged commit 7454275 into main Jun 28, 2026
14 checks passed
@bpalermo
bpalermo deleted the worktree-agent-a33706b1f5b6d5a46 branch June 28, 2026 19:06
bpalermo added a commit that referenced this pull request Aug 1, 2026
Renumber 002 -> 034 (002 is taken by the merged agent-concurrency
audit) and revise every code reference after two months of drift:

- Ports post-030: inbound is 18008 (defaultInboundPort); the outbound
  listener is unchanged at 18081 (mesh.ProxyOutboundPort)
- Multi-port routing (005): delivery is app_<pod>_<port>, so the
  original "port is ignored for delivery" semantic is REVERSED —
  port(s) stay required for demux/EDS; the annotation only changes
  what the app cluster dials (one socket serves all declared ports)
- Redirect-all (022) + mesh DNS narrowed Phase 2's audience; keep it,
  priority lowered, re-evaluate after Phase 1
- E/W waypoint (019) and cleartext inbound (#421) confirmed covered
  for free (delivery sits behind the inbound listener)
- New facts folded in: UID already fetched but deliberately not
  persisted (resubscribe.go), storage is protojson in agent/storage,
  builder is exported GenerateOutboundHTTPListener with the 025/#470
  extension union (hoisted per-loop in #615), authz emptyDir socket
  (#499) documented as the intra-pod precedent (cross-pod still needs
  the kubelet hostPath), RESULT_IGNORED unmanaged pods, TCP
  connect-probe analogue on pipes
- New constraint: the kubelet-pods mount must not be readOnly
  (connect(2) on AF_UNIX needs write on the inode; EROFS otherwise)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
bpalermo added a commit that referenced this pull request Aug 1, 2026
* docs: proposal 002 — UDS support for pods

Plan for letting pods serve on and dial the mesh via Unix domain sockets,
in two phases (inbound first). Pathname UDS is mount-namespace-scoped, so
the design bridges pod emptyDir volumes to the node proxy through kubelet's
pod-volumes directory; abstract sockets and workload hostPath mounts are
evaluated and rejected. Registry/EDS endpoints stay TCP :15008, so UDS pods
are indistinguishable from TCP pods to clients.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(034): re-ground the pod-UDS proposal in the current codebase

Renumber 002 -> 034 (002 is taken by the merged agent-concurrency
audit) and revise every code reference after two months of drift:

- Ports post-030: inbound is 18008 (defaultInboundPort); the outbound
  listener is unchanged at 18081 (mesh.ProxyOutboundPort)
- Multi-port routing (005): delivery is app_<pod>_<port>, so the
  original "port is ignored for delivery" semantic is REVERSED —
  port(s) stay required for demux/EDS; the annotation only changes
  what the app cluster dials (one socket serves all declared ports)
- Redirect-all (022) + mesh DNS narrowed Phase 2's audience; keep it,
  priority lowered, re-evaluate after Phase 1
- E/W waypoint (019) and cleartext inbound (#421) confirmed covered
  for free (delivery sits behind the inbound listener)
- New facts folded in: UID already fetched but deliberately not
  persisted (resubscribe.go), storage is protojson in agent/storage,
  builder is exported GenerateOutboundHTTPListener with the 025/#470
  extension union (hoisted per-loop in #615), authz emptyDir socket
  (#499) documented as the intra-pod precedent (cross-pod still needs
  the kubelet hostPath), RESULT_IGNORED unmanaged pods, TCP
  connect-probe analogue on pipes
- New constraint: the kubelet-pods mount must not be readOnly
  (connect(2) on AF_UNIX needs write on the inode; EROFS otherwise)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 7, 2026
) (#741)

Agent startup no longer exits when SPIRE is not serving yet. The one-shot,
fatal `commonspire.NewSource` (25s bound, #668) is replaced by a
`WaitingSource` runnable that retries forever with bounded, jittered backoff,
serves `ErrNoSVIDYet` meanwhile, and announces the wait at INFO with
attempt/elapsed — escalating to WARN after `--spire-wait-warn-after` (2m).

Everything downstream already tolerated a late identity: the SDS bridge dials
lazily and now also serves the node SVID on the source's `Updated()` wake
rather than the next 30s tick; the registrar watch loop defers (INFO, no
`watch_errors`, no backoff escalation) while the SVID is pending; the xDS cache
omits upstream mTLS until `SetNodeIdentity` lands and Envoy tolerates the absent
secret (#715). The trust domain is seeded with the mesh domain through a small
atomic holder and reconciled against the real SVID when it arrives.

Readiness gains a `spire-svid` check beside `cni-chained`, with a 2m dwell equal
to the warn threshold: the controller's node-taint guard re-arms
`aether.io/agent-not-ready:NoSchedule` after 30s of NotReady and spire-server
does not tolerate that taint, so a hard-from-t=0 gate would fence the cluster
against spire-server's own rescheduling.

New metrics: `aether.agent.spire.wait_seconds` (seconds-oriented buckets, #732),
`aether.agent.spire.source_restarts` (expected 0), `aether.agent.spire.svid_ready`.
Chart: `spire.waitWarnAfter: 2m` threaded to all four components. Runbook: "The
agent is stuck waiting for SPIRE".

The `--spire-enabled=false` path (#421) is unchanged, and nothing in `runAgent`
or `PreListen` is reordered (#700/#712). The controller/registrar/edge sources
still create synchronously; PR 2 moves them.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 7, 2026
…ad of dying on it (#740) (#742)

PR 1 (#741) moved the node agent off the one-shot, fatal `commonspire.NewSource`
(25s bound, #668). This closes the three remaining call sites, which all still
exited the process when SPIRE was not serving yet — measured negative control:
`NewSource` on an unserved socket returns after 25.02s with
`failed to create SPIRE Workload API source: context deadline exceeded`.

Controller (`buildControllerBootstrapOpts`, the earliest of the four — it runs
before `manager.Bootstrap` because the webhook server is built from its options):
constructs a `WaitingSource` and starts its `Run` on the command context, then
hands it to `spire.WebhookServerCert`. The certificate is resolved per handshake
(`tls.Config.GetCertificate`), so a source that is still waiting fails individual
TLS handshakes rather than the process; both webhook configurations are
`failurePolicy: Ignore`, so the apiserver fails OPEN meanwhile — admission
proceeds unvalidated and pods are not ndots-mutated, exactly as they were while
the container was crash-looping, only now the controller is alive and starts
serving the moment the SVID lands. `CABundleInjector.Source` widens to
`SVIDSource` and its initial-inject ERROR becomes INFO on `ErrNoSVIDYet`; the
injection is then performed by the `Updated()` wake `WaitingSource` fires on first
land as well as on rotation, so no retry logic was added.

Registrar (`buildSpireGRPCCreds`): same `WaitingSource`, registered with the
manager. `grpc.Creds` accepts a lazy source because the whole `tls.Config`
resolves at handshake time — the trust-domain resolution moves out of startup and
into `ServerTLSConfigForOwnTrustDomain`, which reads the registrar's own SVID per
handshake (so it stays correct across a rotation), plus one post-arrival callback
that logs the resolved trust domain. Until the SVID lands the registrar authorizes
NOTHING: the handshake fails before the authorizer is ever consulted.

Edge (`resolveEdgeIdentity`): needs the trust domain AND its own SPIFFE ID, so it
returns the seeds (mesh domain, empty ID) immediately and folds the real identity
in on the first SVID. `SnapshotCache.UpdateEdgeIdentity` is the after-start form
of `SetEdgeIdentity` — it rebuilds the cached mTLS clusters and pushes a snapshot,
so the edge Envoy picks the identity up on the next CDS update instead of on a
restart. The empty SPIFFE ID does not leak: `recomputeMTLSClusters` skips
injection entirely while it is empty.

All three register the same `spire-svid` readiness gate (`spire.ReadyCheckName`)
with the same `commonspire.NotReadyDwell` (2m). Here it is load-bearing in a way
it is not on a DaemonSet: these are Deployments behind Services, so past the dwell
the replica leaves the endpoints — the apiserver stops routing admission to a
controller that cannot handshake, agents stop dialing a registrar that cannot, and
the edge stops advertising an ingress whose upstreams have no identity. A workload
that already holds an SVID keeps it, so the gate can only fail one that never got
its first.

The wait's log lines are PR 1's, unchanged and shared, so one LogsQL phrase covers
all four binaries: `waiting for the SPIRE Workload API to issue this workload's
SVID` and `obtained this workload's SVID from the SPIRE Workload API`. Only the
metric namespace differs, via a new minimal `WithComponent` option on
`NewWaitingSource`: `aether.controller.spire.*`, `aether.registrar.spire.*`,
`aether.edge.spire.*` (the agent's names are unchanged by default).

`--spire-enabled=false` (#421) is byte-identical on all three paths — no source,
no runnable, no readiness check, no log line — and pinned by a test each. PR 1's
fake Workload API server moves to `common/spire/spiretest` so all four binaries
test against it.

Chart: the values.yaml note is corrected (the dwell now applies to all four
components) and Chart.yaml PATCH bumped. Runbook: the "stuck waiting for SPIRE"
section gains the per-component symptoms.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 7, 2026
…ady (#740) (#743)

The three findings from #741's on-cluster validation (talos-main rev209,
2026-09-07). None is a defect in what #741 set out to fix — the agent no longer
dies on a cold SPIRE, 0 restarts across a 6m41s blackout — but the first is a
regression against the crash loop it replaced.

F1. A restarted agent with no SVID cannot handshake to the registrar, so
PreListen's bounded registry-ready wait expires, the local-only fallback fires,
and the agent PUSHES that snapshot — replacing a complete one and evicting every
cross-node endpoint. On main-worker-03 (no local echo replica) ~95% of the
node's mesh_dns probes failed for the whole outage, +5,083 errors, while the
other four nodes were at exactly 0. The crash loop never did this, because a
dying agent publishes nothing and Envoy keeps its last config. PreListen now
holds while identity is pending — INFO `holding xDS until this agent has an
SVID; Envoy keeps its current configuration` every 15s with a rising elapsed —
and the registry wait plus its local-only fallback apply unchanged from the
moment identity exists. Mid-life is already correct and is untouched: once a
snapshot is published the cache keeps it.

F2. The controller's node-taint guard re-armed `aether.io/agent-not-ready` 30s
after the agent went NotReady, and the agent's own remover — gated on the CNI
socket and conflist chaining only (#667) — dropped it ~50ms later, eight times
in a row. The node was tainted for ~50ms per 30s, i.e. never. The remover now
consults the SAME readiness aggregate the kubelet polls, so both controllers
read one verdict; the socket+chained conditions keep their #667 semantics. This
is safe now that spire-server, spire-agent and the SPIFFE CSI driver tolerate
the taint (k8s-talos-main #45), which is why SPIRE was kept out of the gate
before.

F3. Recovery was announced 2m11s early: readyz `spire-svid` passed 3s after the
SVID landed while every mTLS client kept failing `could not get X509 bundle`.
Two causes, both fixed — readiness now means SVID AND the bundle for its trust
domain (the WaitingSource publishes its source only when both are servable), and
the registrar client is woken on identity, resetting the gRPC ClientConn's own
backoff (at its ~120s cap by then, answering from the cached handshake failure
rather than dialling) and cutting the retry sleep short.

Also: /readyz?verbose prints `spire-svid failed: reason withheld` because
controller-runtime redacts checker errors, so each check now logs its reason
once per transition — WARN `spire-svid readiness failing` / INFO `… passing`.
Runbook and the values.yaml toleration note updated; the tolerations are now
REQUIRED, not advisory.

`--spire-enabled=false` (#421) is byte-identical: no gate, no check, no hold.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
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