Skip to content

fix(agent): serialize snapshot generation (R1); merge localWorkloads on load (R3) - #109

Merged
bpalermo merged 1 commit into
mainfrom
fix/cache-snapshot-races
Jun 10, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/cache-snapshot-races

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

Implements the two xDS-cache findings from the concurrency audit (docs/proposals/002, #108):

  • R1 (HIGH) — snapshot lost-update: generateSnapshot is called concurrently from CNI add/remove, the registry refresher, SPIRE rotations, and SetNodeIdentity. The version-generate + map-read + SetSnapshot sequence wasn't serialized, so a snapshot built from a stale read could land after a newer one — Envoy sees a version change and applies the stale config (resurrected listener, missing rotated SVID) until the next trigger. A snapshotMu now serializes the sequence: version order == content order, and the last snapshot always reflects final map state.
  • R3 (MEDIUM) — localWorkloads wipe: LoadListenersFromStorage (xDS PreListen) wholesale-replaced localWorkloads while the CNI server may be concurrently adding pods; a pod added between the storage read and the write lost its netns→SPIFFE-ID mapping and presented the node certificate instead of its SVID on outbound mTLS. Now merges.

Tests

  • TestConcurrentMutationsFinalSnapshotComplete — 50 concurrent AddPods; final snapshot must contain all 100 listeners (R1 regression; also exercises map discipline under -race).
  • TestLoadListenersFromStorageMergesLocalWorkloads — AddPod for a pod absent from storage, then the storage load; both mappings must survive (R3 regression).
  • bazel test //agent/internal/xds/cache:cache_test ✅ (also with --@rules_go//go/config:race ✅)

🤖 Generated with Claude Code

…on load (R3)

From the concurrency audit (docs/proposals/002):

R1: generateSnapshot's version-generate + map-read + SetSnapshot sequence was
not serialized across concurrent mutators (CNI add/remove, registry refresher,
SPIRE rotations), so a snapshot built from a stale read could land after a
newer one — Envoy sees a version change and applies the stale config, dropping
the newer mutation until the next trigger. A snapshotMu now serializes the
sequence, making version order equal content order and guaranteeing the last
snapshot reflects the final map state.

R3: LoadListenersFromStorage wholesale-replaced localWorkloads, wiping the
netns→SPIFFE-ID mapping of any pod whose AddPod landed between the storage
read and the write (startup window) — downgrading that pod's outbound mTLS to
the node certificate. It now merges instead.

Regression tests for both (50-way concurrent AddPod final-snapshot check, and
an interleaved AddPod + storage-load merge check); pass with -race.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@bpalermo
bpalermo merged commit cc1f3e2 into main Jun 10, 2026
10 checks passed
@bpalermo
bpalermo deleted the fix/cache-snapshot-races branch June 10, 2026 11:46
bpalermo added a commit that referenced this pull request Jun 10, 2026
…#120)

- docs/workload-requirements.md: how a workload joins the mesh (SA-derived
  service name, managed label, annotations), the outbound listener calling
  convention, the two workload-side settings required for hitless rolls
  (minReadySeconds, native preStop sleep) with the validated termination
  sequence, and the exact retry semantics clients get for free.
- 002 audit doc: status header was stale ("no fixes applied"); all findings
  landed in #109/#110/#111.

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 20, 2026
…nd put the source identity in the pool key (#842)

Replaces the per-identity `transport_socket_matches` + `transport_socket_matcher`
on every mesh cluster with ONE transport socket whose
`custom_tls_certificate_selector` resolves the client certificate per
connection, and drops `connection_pool_per_downstream_connection`.

Both halves are the same mechanism — the source SPIFFE ID in a
downstream-shared filter-state object — so they ship together.

## The filter state

Mesh-originating chains now stamp a third object, under the name Envoy's
`filter_state_override` upstream certificate mapper hardcodes
(`envoy.tls.certificate_mappers.on_demand_secret`) and with the
`envoy.hashable_string` factory. That factory is the whole point:
`set_filter_state`'s default `envoy.string` builds a
`Router::StringAccessorImpl`, which is not `Envoy::Hashable`, and
`CommonUpstreamTransportSocketFactory::hashKey` folds a shared filter-state
object into the upstream pool key only behind a `dynamic_cast` to `Hashable`.

`aether.source.spiffe_id` keeps being stamped for one release: it is what a
pre-#842 cluster's matcher reads, so a rollback stays hitless (the dual-key
overlap #815 used), and it is the access log's `source_spiffe_id`.

## The cluster

    custom_tls_certificate_selector:
      envoy.tls.certificate_selectors.on_demand_secret
        config_source:      ads (the agent's own stream)
        certificate_mapper: ...upstream_certificate_mappers.filter_state_override
                              default_value: <node SVID>
        prefetch_secret_names: [<node SVID>]

The mapper returns the filter-state string VERBATIM as the SDS secret name,
which works only because aether's secret names are SPIFFE IDs. `default_value`
is the node SVID — the same identity, for the same connections, that the removed
matcher's `on_no_match` presented. Workload identities are deliberately NOT
prefetched: listing them would put the node's identity set back into every
cluster's bytes.

Consequence beyond tidiness: a mesh cluster now has NO workload input at all.
#815 release two made cluster bytes invariant under pod churn within a
ServiceAccount; the first pod of a new ServiceAccount arriving and the last one
leaving still rewrote every mesh cluster on the node, each re-warming for the
full 15 s EDS initial_fetch_timeout and draining every upstream pool on the
warming→active swap. Those are free now.

`max_session_keys: 0` (from #834, for #829) becomes a precondition rather than
just a defence: a client context supports a custom certificate selector only
with session resumption off.

## What is deliberately unchanged

- The `inboundready_<pod>` probe cluster keeps its own statically named
  certificate and its own `MaxSessionKeys: 0` (#836/#840). A health checker
  carries no filter state, so a selector there would take `default_value` on
  every probe — the same node SVID by a longer route — while breaking the #836
  boundary that nothing the probe does may be observable by application traffic.
- The edge keeps `EdgeUpstreamTransportSocket`: one identity, no source filter
  state, SDS straight from the SPIRE agent. A selector would add a handshake
  pause and buy nothing.
- The server-identity SAN pin and the SDS-rotated trust bundle. Never per-source.
- The proposal 019 waypoint split, which is about SNI, not certificates — but
  its matcher is now a constant over two fixed sockets (`local`, `waypoint`)
  instead of a two-level tree over the identity set.

## BREAKS A LIVE ALERT — cross-repo

`envoy_cluster_match_count_total{aether_transport_socket_match=...}` does not
exist for mesh clusters any more, because they have no transport-socket matches.
`AetherClusterIdentityNoMatch` (k8s-talos-main, GitOps #109) therefore matches
nothing and evaluates to a clean zero — a vacuous gate, not an error. It must be
removed or repointed in the same window this ships. docs/runbook.md, "#842",
proposes the replacement: the destination access log's
`downstream_peer_uri_san` (already the authoritative check) plus a `-`
`source_spiffe_id` on source-reporter lines, which is exactly the condition that
makes the mapper fall back to `default_value`.

## Tests

`//test/mtlspool` gained a real SDS server (certificate resolution now happens
DURING the handshake, so file-backed certs no longer exercise it) and three
distinct assertions against the pinned Envoy, plus the negative control:

  - 11/11 requests from each source verified as that source;
  - EXACTLY TWO upstream connections, one per identity — the observable that
    distinguishes #842 from the old flag, which would give 22;
  - each connection presented the originating pod's own certificate, never
    `default_value`;
  - negative control, `envoy.string` instead of `envoy.hashable_string` as the
    ONLY change: 11/11 of source-B's requests verified as source-A, on ONE
    shared connection.

`//test/envoy_validate` gained a non-vacuity guard, after checking that an empty
`default_value` really does make `envoy --mode validate` fail. It also
established that the TypedExtensionConfig `name` is informational — a corrupted
one validates fine — so the names are pinned in a unit test instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
…nd put the source identity in the pool key (#842)

Replaces the per-identity `transport_socket_matches` + `transport_socket_matcher`
on every mesh cluster with ONE transport socket whose
`custom_tls_certificate_selector` resolves the client certificate per
connection, and drops `connection_pool_per_downstream_connection`.

Both halves are the same mechanism — the source SPIFFE ID in a
downstream-shared filter-state object — so they ship together.

## The filter state

Mesh-originating chains now stamp a third object, under the name Envoy's
`filter_state_override` upstream certificate mapper hardcodes
(`envoy.tls.certificate_mappers.on_demand_secret`) and with the
`envoy.hashable_string` factory. That factory is the whole point:
`set_filter_state`'s default `envoy.string` builds a
`Router::StringAccessorImpl`, which is not `Envoy::Hashable`, and
`CommonUpstreamTransportSocketFactory::hashKey` folds a shared filter-state
object into the upstream pool key only behind a `dynamic_cast` to `Hashable`.

`aether.source.spiffe_id` keeps being stamped for one release: it is what a
pre-#842 cluster's matcher reads, so a rollback stays hitless (the dual-key
overlap #815 used), and it is the access log's `source_spiffe_id`.

## The cluster

    custom_tls_certificate_selector:
      envoy.tls.certificate_selectors.on_demand_secret
        config_source:      ads (the agent's own stream)
        certificate_mapper: ...upstream_certificate_mappers.filter_state_override
                              default_value: <node SVID>
        prefetch_secret_names: [<node SVID>]

The mapper returns the filter-state string VERBATIM as the SDS secret name,
which works only because aether's secret names are SPIFFE IDs. `default_value`
is the node SVID — the same identity, for the same connections, that the removed
matcher's `on_no_match` presented. Workload identities are deliberately NOT
prefetched: listing them would put the node's identity set back into every
cluster's bytes.

Consequence beyond tidiness: a mesh cluster now has NO workload input at all.
#815 release two made cluster bytes invariant under pod churn within a
ServiceAccount; the first pod of a new ServiceAccount arriving and the last one
leaving still rewrote every mesh cluster on the node, each re-warming for the
full 15 s EDS initial_fetch_timeout and draining every upstream pool on the
warming→active swap. Those are free now.

`max_session_keys: 0` (from #834, for #829) becomes a precondition rather than
just a defence: a client context supports a custom certificate selector only
with session resumption off.

## What is deliberately unchanged

- The `inboundready_<pod>` probe cluster keeps its own statically named
  certificate and its own `MaxSessionKeys: 0` (#836/#840). A health checker
  carries no filter state, so a selector there would take `default_value` on
  every probe — the same node SVID by a longer route — while breaking the #836
  boundary that nothing the probe does may be observable by application traffic.
- The edge keeps `EdgeUpstreamTransportSocket`: one identity, no source filter
  state, SDS straight from the SPIRE agent. A selector would add a handshake
  pause and buy nothing.
- The server-identity SAN pin and the SDS-rotated trust bundle. Never per-source.
- The proposal 019 waypoint split, which is about SNI, not certificates — but
  its matcher is now a constant over two fixed sockets (`local`, `waypoint`)
  instead of a two-level tree over the identity set.

## BREAKS A LIVE ALERT — cross-repo

`envoy_cluster_match_count_total{aether_transport_socket_match=...}` does not
exist for mesh clusters any more, because they have no transport-socket matches.
`AetherClusterIdentityNoMatch` (k8s-talos-main, GitOps #109) therefore matches
nothing and evaluates to a clean zero — a vacuous gate, not an error. It must be
removed or repointed in the same window this ships. docs/runbook.md, "#842",
proposes the replacement: the destination access log's
`downstream_peer_uri_san` (already the authoritative check) plus a `-`
`source_spiffe_id` on source-reporter lines, which is exactly the condition that
makes the mapper fall back to `default_value`.

## Tests

`//test/mtlspool` gained a real SDS server (certificate resolution now happens
DURING the handshake, so file-backed certs no longer exercise it) and three
distinct assertions against the pinned Envoy, plus the negative control:

  - 11/11 requests from each source verified as that source;
  - EXACTLY TWO upstream connections, one per identity — the observable that
    distinguishes #842 from the old flag, which would give 22;
  - each connection presented the originating pod's own certificate, never
    `default_value`;
  - negative control, `envoy.string` instead of `envoy.hashable_string` as the
    ONLY change: 11/11 of source-B's requests verified as source-A, on ONE
    shared connection.

`//test/envoy_validate` gained a non-vacuity guard, after checking that an empty
`default_value` really does make `envoy --mode validate` fail. It also
established that the TypedExtensionConfig `name` is informational — a corrupted
one validates fine — so the names are pinned in a unit test instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
…nd put the source identity in the pool key (#842)

Replaces the per-identity `transport_socket_matches` + `transport_socket_matcher`
on every mesh cluster with ONE transport socket whose
`custom_tls_certificate_selector` resolves the client certificate per
connection, and drops `connection_pool_per_downstream_connection`.

Both halves are the same mechanism — the source SPIFFE ID in a
downstream-shared filter-state object — so they ship together.

## The filter state

Mesh-originating chains now stamp a third object, under the name Envoy's
`filter_state_override` upstream certificate mapper hardcodes
(`envoy.tls.certificate_mappers.on_demand_secret`) and with the
`envoy.hashable_string` factory. That factory is the whole point:
`set_filter_state`'s default `envoy.string` builds a
`Router::StringAccessorImpl`, which is not `Envoy::Hashable`, and
`CommonUpstreamTransportSocketFactory::hashKey` folds a shared filter-state
object into the upstream pool key only behind a `dynamic_cast` to `Hashable`.

`aether.source.spiffe_id` keeps being stamped for one release: it is what a
pre-#842 cluster's matcher reads, so a rollback stays hitless (the dual-key
overlap #815 used), and it is the access log's `source_spiffe_id`.

## The cluster

    custom_tls_certificate_selector:
      envoy.tls.certificate_selectors.on_demand_secret
        config_source:      ads (the agent's own stream)
        certificate_mapper: ...upstream_certificate_mappers.filter_state_override
                              default_value: <node SVID>
        prefetch_secret_names: [<node SVID>]

The mapper returns the filter-state string VERBATIM as the SDS secret name,
which works only because aether's secret names are SPIFFE IDs. `default_value`
is the node SVID — the same identity, for the same connections, that the removed
matcher's `on_no_match` presented. Workload identities are deliberately NOT
prefetched: listing them would put the node's identity set back into every
cluster's bytes.

Consequence beyond tidiness: a mesh cluster now has NO workload input at all.
#815 release two made cluster bytes invariant under pod churn within a
ServiceAccount; the first pod of a new ServiceAccount arriving and the last one
leaving still rewrote every mesh cluster on the node, each re-warming for the
full 15 s EDS initial_fetch_timeout and draining every upstream pool on the
warming→active swap. Those are free now.

`max_session_keys: 0` (from #834, for #829) becomes a precondition rather than
just a defence: a client context supports a custom certificate selector only
with session resumption off.

## What is deliberately unchanged

- The `inboundready_<pod>` probe cluster keeps its own statically named
  certificate and its own `MaxSessionKeys: 0` (#836/#840). A health checker
  carries no filter state, so a selector there would take `default_value` on
  every probe — the same node SVID by a longer route — while breaking the #836
  boundary that nothing the probe does may be observable by application traffic.
- The edge keeps `EdgeUpstreamTransportSocket`: one identity, no source filter
  state, SDS straight from the SPIRE agent. A selector would add a handshake
  pause and buy nothing.
- The server-identity SAN pin and the SDS-rotated trust bundle. Never per-source.
- The proposal 019 waypoint split, which is about SNI, not certificates — but
  its matcher is now a constant over two fixed sockets (`local`, `waypoint`)
  instead of a two-level tree over the identity set.

## BREAKS A LIVE ALERT — cross-repo

`envoy_cluster_match_count_total{aether_transport_socket_match=...}` does not
exist for mesh clusters any more, because they have no transport-socket matches.
`AetherClusterIdentityNoMatch` (k8s-talos-main, GitOps #109) therefore matches
nothing and evaluates to a clean zero — a vacuous gate, not an error. It must be
removed or repointed in the same window this ships. docs/runbook.md, "#842",
proposes the replacement: the destination access log's
`downstream_peer_uri_san` (already the authoritative check) plus a `-`
`source_spiffe_id` on source-reporter lines, which is exactly the condition that
makes the mapper fall back to `default_value`.

## Tests

`//test/mtlspool` gained a real SDS server (certificate resolution now happens
DURING the handshake, so file-backed certs no longer exercise it) and three
distinct assertions against the pinned Envoy, plus the negative control:

  - 11/11 requests from each source verified as that source;
  - EXACTLY TWO upstream connections, one per identity — the observable that
    distinguishes #842 from the old flag, which would give 22;
  - each connection presented the originating pod's own certificate, never
    `default_value`;
  - negative control, `envoy.string` instead of `envoy.hashable_string` as the
    ONLY change: 11/11 of source-B's requests verified as source-A, on ONE
    shared connection.

`//test/envoy_validate` gained a non-vacuity guard, after checking that an empty
`default_value` really does make `envoy --mode validate` fail. It also
established that the TypedExtensionConfig `name` is informational — a corrupted
one validates fine — so the names are pinned in a unit test instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
…nd put the source identity in the pool key (#842)

Replaces the per-identity `transport_socket_matches` + `transport_socket_matcher`
on every mesh cluster with ONE transport socket whose
`custom_tls_certificate_selector` resolves the client certificate per
connection, and drops `connection_pool_per_downstream_connection`.

Both halves are the same mechanism — the source SPIFFE ID in a
downstream-shared filter-state object — so they ship together.

## The filter state

Mesh-originating chains now stamp a third object, under the name Envoy's
`filter_state_override` upstream certificate mapper hardcodes
(`envoy.tls.certificate_mappers.on_demand_secret`) and with the
`envoy.hashable_string` factory. That factory is the whole point:
`set_filter_state`'s default `envoy.string` builds a
`Router::StringAccessorImpl`, which is not `Envoy::Hashable`, and
`CommonUpstreamTransportSocketFactory::hashKey` folds a shared filter-state
object into the upstream pool key only behind a `dynamic_cast` to `Hashable`.

`aether.source.spiffe_id` keeps being stamped for one release: it is what a
pre-#842 cluster's matcher reads, so a rollback stays hitless (the dual-key
overlap #815 used), and it is the access log's `source_spiffe_id`.

## The cluster

    custom_tls_certificate_selector:
      envoy.tls.certificate_selectors.on_demand_secret
        config_source:      ads (the agent's own stream)
        certificate_mapper: ...upstream_certificate_mappers.filter_state_override
                              default_value: <node SVID>
        prefetch_secret_names: [<node SVID>]

The mapper returns the filter-state string VERBATIM as the SDS secret name,
which works only because aether's secret names are SPIFFE IDs. `default_value`
is the node SVID — the same identity, for the same connections, that the removed
matcher's `on_no_match` presented. Workload identities are deliberately NOT
prefetched: listing them would put the node's identity set back into every
cluster's bytes.

Consequence beyond tidiness: a mesh cluster now has NO workload input at all.
#815 release two made cluster bytes invariant under pod churn within a
ServiceAccount; the first pod of a new ServiceAccount arriving and the last one
leaving still rewrote every mesh cluster on the node, each re-warming for the
full 15 s EDS initial_fetch_timeout and draining every upstream pool on the
warming→active swap. Those are free now.

`max_session_keys: 0` (from #834, for #829) becomes a precondition rather than
just a defence: a client context supports a custom certificate selector only
with session resumption off.

## What is deliberately unchanged

- The `inboundready_<pod>` probe cluster keeps its own statically named
  certificate and its own `MaxSessionKeys: 0` (#836/#840). A health checker
  carries no filter state, so a selector there would take `default_value` on
  every probe — the same node SVID by a longer route — while breaking the #836
  boundary that nothing the probe does may be observable by application traffic.
- The edge keeps `EdgeUpstreamTransportSocket`: one identity, no source filter
  state, SDS straight from the SPIRE agent. A selector would add a handshake
  pause and buy nothing.
- The server-identity SAN pin and the SDS-rotated trust bundle. Never per-source.
- The proposal 019 waypoint split, which is about SNI, not certificates — but
  its matcher is now a constant over two fixed sockets (`local`, `waypoint`)
  instead of a two-level tree over the identity set.

## BREAKS A LIVE ALERT — cross-repo

`envoy_cluster_match_count_total{aether_transport_socket_match=...}` does not
exist for mesh clusters any more, because they have no transport-socket matches.
`AetherClusterIdentityNoMatch` (k8s-talos-main, GitOps #109) therefore matches
nothing and evaluates to a clean zero — a vacuous gate, not an error. It must be
removed or repointed in the same window this ships. docs/runbook.md, "#842",
proposes the replacement: the destination access log's
`downstream_peer_uri_san` (already the authoritative check) plus a `-`
`source_spiffe_id` on source-reporter lines, which is exactly the condition that
makes the mapper fall back to `default_value`.

## Tests

`//test/mtlspool` gained a real SDS server (certificate resolution now happens
DURING the handshake, so file-backed certs no longer exercise it) and three
distinct assertions against the pinned Envoy, plus the negative control:

  - 11/11 requests from each source verified as that source;
  - EXACTLY TWO upstream connections, one per identity — the observable that
    distinguishes #842 from the old flag, which would give 22;
  - each connection presented the originating pod's own certificate, never
    `default_value`;
  - negative control, `envoy.string` instead of `envoy.hashable_string` as the
    ONLY change: 11/11 of source-B's requests verified as source-A, on ONE
    shared connection.

`//test/envoy_validate` gained a non-vacuity guard, after checking that an empty
`default_value` really does make `envoy --mode validate` fail. It also
established that the TypedExtensionConfig `name` is informational — a corrupted
one validates fine — so the names are pinned in a unit test instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo added a commit that referenced this pull request Sep 20, 2026
…nd put the source identity in the pool key (#842) (#863)

Replaces the per-identity `transport_socket_matches` + `transport_socket_matcher`
on every mesh cluster with ONE transport socket whose
`custom_tls_certificate_selector` resolves the client certificate per
connection, and drops `connection_pool_per_downstream_connection`.

Both halves are the same mechanism — the source SPIFFE ID in a
downstream-shared filter-state object — so they ship together.

## The filter state

Mesh-originating chains now stamp a third object, under the name Envoy's
`filter_state_override` upstream certificate mapper hardcodes
(`envoy.tls.certificate_mappers.on_demand_secret`) and with the
`envoy.hashable_string` factory. That factory is the whole point:
`set_filter_state`'s default `envoy.string` builds a
`Router::StringAccessorImpl`, which is not `Envoy::Hashable`, and
`CommonUpstreamTransportSocketFactory::hashKey` folds a shared filter-state
object into the upstream pool key only behind a `dynamic_cast` to `Hashable`.

`aether.source.spiffe_id` keeps being stamped for one release: it is what a
pre-#842 cluster's matcher reads, so a rollback stays hitless (the dual-key
overlap #815 used), and it is the access log's `source_spiffe_id`.

## The cluster

    custom_tls_certificate_selector:
      envoy.tls.certificate_selectors.on_demand_secret
        config_source:      ads (the agent's own stream)
        certificate_mapper: ...upstream_certificate_mappers.filter_state_override
                              default_value: <node SVID>
        prefetch_secret_names: [<node SVID>]

The mapper returns the filter-state string VERBATIM as the SDS secret name,
which works only because aether's secret names are SPIFFE IDs. `default_value`
is the node SVID — the same identity, for the same connections, that the removed
matcher's `on_no_match` presented. Workload identities are deliberately NOT
prefetched: listing them would put the node's identity set back into every
cluster's bytes.

Consequence beyond tidiness: a mesh cluster now has NO workload input at all.
#815 release two made cluster bytes invariant under pod churn within a
ServiceAccount; the first pod of a new ServiceAccount arriving and the last one
leaving still rewrote every mesh cluster on the node, each re-warming for the
full 15 s EDS initial_fetch_timeout and draining every upstream pool on the
warming→active swap. Those are free now.

`max_session_keys: 0` (from #834, for #829) becomes a precondition rather than
just a defence: a client context supports a custom certificate selector only
with session resumption off.

## What is deliberately unchanged

- The `inboundready_<pod>` probe cluster keeps its own statically named
  certificate and its own `MaxSessionKeys: 0` (#836/#840). A health checker
  carries no filter state, so a selector there would take `default_value` on
  every probe — the same node SVID by a longer route — while breaking the #836
  boundary that nothing the probe does may be observable by application traffic.
- The edge keeps `EdgeUpstreamTransportSocket`: one identity, no source filter
  state, SDS straight from the SPIRE agent. A selector would add a handshake
  pause and buy nothing.
- The server-identity SAN pin and the SDS-rotated trust bundle. Never per-source.
- The proposal 019 waypoint split, which is about SNI, not certificates — but
  its matcher is now a constant over two fixed sockets (`local`, `waypoint`)
  instead of a two-level tree over the identity set.

## BREAKS A LIVE ALERT — cross-repo

`envoy_cluster_match_count_total{aether_transport_socket_match=...}` does not
exist for mesh clusters any more, because they have no transport-socket matches.
`AetherClusterIdentityNoMatch` (k8s-talos-main, GitOps #109) therefore matches
nothing and evaluates to a clean zero — a vacuous gate, not an error. It must be
removed or repointed in the same window this ships. docs/runbook.md, "#842",
proposes the replacement: the destination access log's
`downstream_peer_uri_san` (already the authoritative check) plus a `-`
`source_spiffe_id` on source-reporter lines, which is exactly the condition that
makes the mapper fall back to `default_value`.

## Tests

`//test/mtlspool` gained a real SDS server (certificate resolution now happens
DURING the handshake, so file-backed certs no longer exercise it) and three
distinct assertions against the pinned Envoy, plus the negative control:

  - 11/11 requests from each source verified as that source;
  - EXACTLY TWO upstream connections, one per identity — the observable that
    distinguishes #842 from the old flag, which would give 22;
  - each connection presented the originating pod's own certificate, never
    `default_value`;
  - negative control, `envoy.string` instead of `envoy.hashable_string` as the
    ONLY change: 11/11 of source-B's requests verified as source-A, on ONE
    shared connection.

`//test/envoy_validate` gained a non-vacuity guard, after checking that an empty
`default_value` really does make `envoy --mode validate` fail. It also
established that the TypedExtensionConfig `name` is informational — a corrupted
one validates fine — so the names are pinned in a unit test instead.


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

Co-authored-by: Claude Opus 5 <[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