Repository navigation
feat(agent): the unpinned-cluster warning gives each cluster its own cause, and gauges record the SAN-pin state published and acknowledged (#1424, #1425) - #1479
Merged
Conversation
…cause, and gauges record the SAN-pin state published and acknowledged (#1424, #1425) The WARN `mesh clusters published with no server-identity SAN pin` picked one reason for the whole line from the trust domain at report time. The cause is now recorded by the render that left the pin empty and each cluster is named under its own: one line per reason (a closed set of three), at most 20 names per line. aether.agent.snapshot.tls_clusters{pin,reason} is the number of mesh cluster entries pinned and unpinned in the current snapshot, per reason, written on every snapshot with zeros included. aether.agent.xds.acked_tls_clusters has the same series for the last snapshot whose cluster update the proxy acknowledged: the ACK tracker now carries a response's system_version_info to an observer, and the cache keeps the pin counts of the last 64 snapshot versions. aether.agent.identity.cluster_unpinned gains the reason attribute. No metric carries a cluster name. A snapshot build makes the same single pass over the cluster entries as before and allocates nothing for it on a node where every cluster is pinned. The soak grade (prober-grade.sh) sums the counter over every series as before and now also prints the count per reason. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
Pin counts can race cluster mutation and be associated with a snapshot containing different resources.
2 open findings
What changed in this PR
Adds cause-specific SAN-pin diagnostics and gauges for published versus proxy-acknowledged cluster state.
Changes:
- Records and reports per-cluster unpinned causes.
- Tracks snapshot pin counts through xDS ACKs.
- Updates soak grading, tests, fixtures, and operator documentation.
| File | Description |
|---|---|
e2e/soak/testdata/prober-grade/reset/unpinned.window.json |
Models mixed-version counter series. |
e2e/soak/testdata/prober-grade/clean/unpinned.window.json |
Adds per-reason window fixtures. |
e2e/soak/testdata/prober-grade/clean/unpinned.start.json |
Adds per-reason start fixtures. |
e2e/soak/README.md |
Documents reason-aware grading. |
e2e/soak/prober-grade.sh |
Reports increases by reason. |
e2e/soak/harness_test.sh |
Tests reason-aware grading output. |
docs/runbook.md |
Documents SAN-pin signals and remediation. |
docs/observability/README.md |
Adds metric reference and PromQL. |
agent/test/envoy_validate/validate_test.go |
Updates helper reference. |
agent/test/envoy_validate/builders.go |
Exposes per-cluster TLS pin classification. |
agent/test/envoy_validate/BUILD.bazel |
Permits cache tests to use validation helpers. |
agent/internal/xds/cache/trustdomain_test.go |
Updates reason assertions. |
agent/internal/xds/cache/snapshot.go |
Associates pin counts with snapshot versions. |
agent/internal/xds/cache/pinreport.go |
Implements pin classification and reporting. |
agent/internal/xds/cache/pinreport_test.go |
Tests reporting, gauges, and validation parity. |
agent/internal/xds/cache/pinhistory.go |
Tracks acknowledged snapshot pin state. |
agent/internal/xds/cache/pinhistory_test.go |
Tests history and ACK behavior. |
agent/internal/xds/cache/mtls.go |
Records SAN-pin causes during rendering. |
agent/internal/xds/cache/cachemetrics/cachemetrics.go |
Adds reason labels and TLS-cluster gauges. |
agent/internal/xds/cache/cachemetrics/cachemetrics_test.go |
Tests metric shape and values. |
agent/internal/xds/cache/cache.go |
Stores pin metadata and history. |
agent/internal/xds/cache/BUILD.bazel |
Registers new sources and dependencies. |
agent/internal/xds/ack/tracker.go |
Exposes acknowledged snapshot versions. |
agent/internal/xds/ack/tracker_test.go |
Tests ACK observer semantics. |
agent/internal/cmd/root.go |
Wires node-agent ACK observations. |
agent/internal/cmd/edge.go |
Wires edge ACK observations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…at collects the snapshot's clusters; the runbook says what no_namespace_metadata means before the node SVID (#1425) The report was read in a second pass, later in the build. A registry reload or an identity change landing in between would have filed the pin state of clusters the proxy was never sent under the snapshot's version, and a cluster ACK of that version would have published it as acknowledged. It is now classified in the pass that collects the cluster resources, which also removes the separate pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Oct 9, 2026
Closed
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #1424
Closes #1425
Builds on #1421 (the report leaves out the plaintext UDP floor).
What
#1424: each cluster gets its own cause. The WARN
mesh clusters published with no server-identity SAN pinchose onereasonfor the whole line from the trust domain at the time of the report, so whenever the trust domain was known every cluster it named was said to have endpoints without namespace metadata. The cause is now recorded by the one function that can leave a pin empty (renderSANPin), on the cluster entry, and the report names each cluster under its own:reasonper snapshot, andreasonis a closed set of three:trust_domain_unknown(transient: ends with the first snapshot after the agent learns its trust domain),no_namespace_metadata(not transient: the registry serves endpoints with no namespace, so no SPIFFE ID can be built; this is the mTLS validation gap),pin_not_rendered(no code path does it; an entry that reached a snapshot unrendered gets a cause of its own instead of borrowing one);.... So a snapshot logs at most 3 lines of 20 names however many clusters are unpinned.countis the reason's exact number;unpinnedandpinnedare the snapshot's totals.The UDP floor is still named nowhere: it is plaintext by design, not unpinned (#1393).
#1425: what was published, and what the proxy acknowledged.
aether_agent_snapshot_tls_clusterspin,reasonpin="pinned", andpin="unpinned"once per reason. Written on every snapshot, zeros includedaether_agent_xds_acked_tls_clusterspin,reasonaether_agent_identity_cluster_unpinned_totalreason(new)No metric carries a cluster name: each gauge is four series per agent and the counter three, whatever the size of the mesh. "N clusters unpinned for reason R on this node" is
sum by (node, reason) (aether_agent_snapshot_tls_clusters{pin="unpinned"}).Published versus acknowledged uses what the ACK tracker already sees. A delta response carries the version of the snapshot it was built from (
system_version_info; go-control-plane sets it to the snapshot's version) and the ACK echoes only the nonce, so the tracker now keeps that version with the in-flight response and hands it to an observer on ACK (never on NACK). The cache keeps the pin counts of its last 64 snapshot versions and turns a cluster ACK into the gauge. The two gauges agree at rest, differ while an update is in flight, and stay different for as long as the proxy rejects cluster updates. The agent logs the acknowledged state only when it changes.What the acknowledged gauge cannot know is written where it is computed and in the runbook: nothing is recorded before the first cluster ACK the agent process sees (an agent that restarts against a proxy already holding the current clusters owes it no update, so there is no ACK until a cluster next changes; absent means "not known", and in that state the proxy holds what the published gauge shows); the ACK names a snapshot version, not the clusters applied; during a hot restart the last ACK from either proxy generation wins.
Why this shape
clusterMu.RLockthat collects the snapshot's clusters (one pass fewer thanmain, and the counts are of exactly the clusters that version carries). The counts are a fixed-size value, names are collected only for unpinned entries, the history is a fixed ring, and the gauges' attribute sets are built once at registration.TestPinReportCostsNoAllocationPerClusterholds the pass over 500 pinned clusters to zero allocations. The cause is rendered with the pin, inside the existing mTLS render memo (agent: a registry refresh rebuilds every cluster entry as new protos, so the snapshot version memo never reuses them (refresh still ~400 ms p99 at 200m) #1115), so nothing new is computed per refresh. No lock is added to a build path except the history's own leaf mutex;depMuis not touched. The ACK path takes that leaf mutex and nothing else, so the xDS stream never waits on a build.SetSnapshot, becauseSetSnapshotis what lets a proxy acknowledge the version.pinStateis the single decision the line, the counter and the gauges are built from.TestRuntimePinReportAgreesWithTheBuildTimeGateputs a snapshot the real cache generated (HTTP, port aliases, TCP floor and per-port, UDP, QUIC twins, a probe cluster) through the build-time gate of//agent/test/envoy_validateand requires the same answer by cluster name, so the two cannot drift apart again as they did in agent: "mesh clusters published with no server-identity SAN pin" logged six times in 16 s during a service roll #1393. For that the gate's walk is exposed per cluster (MeshClusterPins);UnpinnedMeshClustersruns on the same walk and returns what it did.//agent/test/envoy_validate/...passes unchanged.The soak gate (
e2e/soak/prober-grade.sh), changed in this PRThe
UNPINNEDgate reads the counter by name and sums every series, so it keeps working on the new shape with no change: with the new fixture and the old script the verdict was alreadyFAIL increase=2. Changed here, with its fixtures andharness_test.sh:UNPINNED reason=<reason> count=N nodes=…for each reason that moved (reason=-for a series from an agent before this change);resetfixture's rolled agent now exports the three per-reason series, next to old agents that export one (an upgrade roll); thecleanfixture is entirely the new shape (15 series,PASS);bornstays the old shape;Evidence
Each behaviour was seen red by reverting the production line it tests, then green; every such edit was reverted and the tree checked clean before the next.
pinStatereturns one cause for allTestUnpinnedClusterReportGivesEachClusterItsOwnCause,TestUnpinnedCauseIsTheRendersNotTheReports,TestTLSClusterGaugeFollowsTheTrustDomainWindow,TestRuntimePinReportNeverMissesWhatTheGateFinds,TestEmptyTrustDomainReportsUnpinnedClustersTestUnpinnedClusterReportBoundsTheNamesPerCauseTestTLSClusterGaugeByReasonThroughAPinAndARemoval,TestCacheMetrics_TLSClusterPinsand ten moreclusterattribute added to the gauge…carries attributes beyond pin and reason)remembermoved afterSetSnapshotTestSnapshotIsInThePinHistoryBeforeItCanBeAckedTestAckObserver_ToldTheSnapshotVersionOfEveryAck,TestAckTrackerFeedsTheAckedPinGaugegrade resetassertions (series counts and the moved line)Run on the final tree:
bazel test //agent/internal/xds/... //agent/internal/cmd/... //agent/internal/cni/server/... //agent/test/envoy_validate/... //e2e/soak:harness_test: 12 of 12 passbazel test --config=raceoncache_test,cachemetrics_test,ack_test,cmd_test,envoy_validate_test: pass; the new ACK and gauge tests 40 times under race: passbazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: passmake format-check: pass;make gazelle: no further changego vetwith the pinned plaingoover the touched packages aftermake materialize-go(the cache's tests now importagent/test/envoy_validate): cleanMetric names: read-only, on a test cluster, the existing gauge
aether.agent.snapshot.clustersis stored asaether_agent_snapshot_clustersand the counter asaether_agent_identity_cluster_unpinned_totalwithjobandnodelabels, for the node agent and for the edge. The new Prometheus names above are inferred from that, not observed.Not verified
This has not run on a cluster.
pin,reason) are inferred from how the collector renames the existing metrics.go build ./...was not run locally (onlygo veton the touched packages); the CodeQL job does it.What the first deploy should show, per node agent and for the edge:
aether_agent_snapshot_tls_clusters: four series each,pin="pinned"above zero and the threepin="unpinned"series at0at rest. Right after an agent start,reason="trust_domain_unknown"may be above zero for a snapshot or two.aether_agent_identity_cluster_unpinned_total: three series per agent (reason), all starting at zero in the new pods. A dashboard or rule that sums it is unaffected; one that selects a single series is not.aether_agent_xds_acked_tls_clusters: present on a node once its proxy has acknowledged a cluster update from the new agent (a proxy roll or any cluster change does it), equal to the published gauge at rest. One INFO lineproxy acknowledged mesh clusters, all with a server-identity SAN pinper agent start is expected.reasonand names should match the gauge's count for that reason.prober-grade.shover a window that includes the agent roll:UNPINNED verdict=PASSunless the roll itself publishedtrust_domain_unknownsnapshots, which it would now print asUNPINNED reason=trust_domain_unknown ….Docs
docs/runbook.md, "The unpinned-cluster signal": the four signals, what each reason means and what to do, the gauges and their PromQL, published versus acknowledged.docs/observability/README.md: a metrics reference for the three metrics and the expression an alert would be built on (no rule file ships).e2e/soak/README.md: the gate on the per-reason counter.An agent wrote this pull request, finishing a branch another agent had started.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr