feat(mgmt-agent): add guarded SWIFT router Pod mitigation (AROSLSRE-2322) #7296
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7296"
general
weight: 0.35
deads2k
AROSLSRE-2322
What
Add one controller to mgmt-agent for router Pods stuck creating their initial SWIFT network sandbox. It uses Kubernetes eviction to give the router Deployment a chance to create a working replacement. It does not cordon, drain or delete the Node.
Eligibility and safety
minReadySecondsand meet the configured floor. Replacement placement must fit within resource and scheduling limits. The search holds after 4,096 Pod/node attempts.Admission allows canonical SWIFT-NIC and memory-pressure tolerations plus binding-added region/zone labels that match the source Node. Hard scheduling selectors depending on region/zone Pod labels hold admission rather than treating source labels as replacement labels. Eligibility logging is configuration-fenced.
Eviction flow
Configuration and accounting
Disabled by default. The deployment flag gates controller construction, event-handler registration and the configuration informer. In an enabled deployment, runtime
auditchecks eligibility without writes,enforcepermits guarded eviction, anddisabledstops mitigation without a rollout.Eviction history lives in a separately initialized ConfigMap, survives restarts, and is never created or reset by the controller or Helm. Missing or invalid history blocks action. Denied, timed-out and uncertain attempts consume allowance.
Why
A management Node can be Ready while an individual router Pod keeps failing to create its network sandbox. This needs a Pod-level recovery action, not Node disruption.
The safety checks matter even for a Pod that has never run: Kubernetes can evict Pending Pods without enforcing their PDB. The controller therefore checks router availability itself and accounts for other pending Pods and outstanding SWIFT NIC allocations when assessing capacity. There is no direct Pod deletion fallback.
Testing
minReadySecondsboundary, disjoint healthy/available replicas, and readiness resets in audit and pre/post-claim admission. Eight hold cases detect the missing per-Pod check; zero-delay and mature replicas remain supported.Admission compatibility and audit-fence regressions pass in the full mgmt-agent race suite and fail against the unfixed implementation. Audit and enforce tests cover the combined injected fields through admission and post-claim checks.
Reconcile logs use the standard
controller_namefield. A worker regression checks the controller, inherited component and Pod fields on the emitted audit log.Personal DEV audit: one full passing run against the real Kubernetes API in westus3, using a local controller with a read-only transport and one isolated router fixture.
| Check | Result |
| --- | --- |
| Floor 1, zero available replicas | Held |
| Floor 0, synthetic sustained SWIFT evidence | Eligible |
| Disabled mode, corrupt accounting, stale evidence | Held |
| Re-enabled audit, fresh evidence | Eligible |
| Same Pod recovered after fixture RuntimeClass repair | Not eligible |
| Controller transport | 239 reads, zero write attempts |
| Pod/ledger identity and cleanup | Preserved, fixtures removed, installed mgmt-agent unchanged |
DEV audit evidence and harness include source provenance and local validation logs for clean commit
e9bb2a5b1. The sandbox failure was real; the SWIFT Event was synthetic. This does not validate live eviction, SWIFT recovery or a production availability floor. Disabled, stale and recovered observations lasted 10 seconds each.Accounting conflict tests inject fake-client errors; a separate HTTP test checks the MTPNC resource path.
Special notes for your reviewer
Start with
mgmt-agent/pkg/controller/swiftpod/eviction.gofor the mitigation flow. The controller lives inmgmt-agent/pkg/controller/swiftpod:| File | Responsibility |
| --- | --- |
|
controller.go| Pod-keyed scheduling, retries and the configuration fence. ||
candidate.go| Initial sandbox-failure evidence, using shared node-health primitives without changing node-health behavior. ||
workloads.go| Workload ownership, availability and replacement-template admission. ||
placement.go| Bounded replacement capacity and scheduling checks. ||
snapshot.go| Fresh cluster and delegated NIC reads, with single-pass Pod and Event indexes by Node for fault evaluation. ||
budget.go| Durable eviction limits and attempt accounting. ||
eviction.go| Ownership claim, fresh admission, attempt recording and guarded eviction. ||
config.go| Runtime policy defaults, parsing and validation. |Each admission uses its own fresh snapshot. Startup wiring is in
mgmt-agent/cmd/options.go; Helm, schema, generated configuration and module dependencies are included. The two conditional Helm templates are excluded from plain-YAML lint and covered by rendered Helm tests.Out of scope: generic mitigation frameworks, custom accounting APIs, never-ready mitigation, Node disruption, Azure operations and environment enablement. There are no pipeline, Dockerfile or Makefile changes.
Limits: placement does not reserve capacity or guarantee a different destination Node or successful recovery. Operations documentation covers the full safety checks, configuration, accounting initialization and migration.
PR Checklist
If E2E tests are included:
demonstrate that the test is able to detect a defect/error and fail with
proper error message and logs which communicates nature of the problem.