Fix VirtualMCPServer reconciliation - #6465
Conversation
ConfigMap watches previously scanned every VirtualMCPServer in a namespace, while validation paths could report success after a status write failed. Index referenced ConfigMaps for targeted fan-out and return status update errors so controller-runtime retries incomplete reconciliation. Refs #6205
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6465 +/- ##
==========================================
+ Coverage 78.02% 78.08% +0.05%
==========================================
Files 767 767
Lines 74273 74281 +8
==========================================
+ Hits 57955 58003 +48
+ Misses 16313 16273 -40
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JAORMX
left a comment
There was a problem hiding this comment.
The indexed reverse lookup preserves the existing authz, upstream CA, and trusted-issuer CA ConfigMap paths while removing the namespace-wide scan. Namespace scoping and error propagation both look correct, and the operator tests and CI are green.
Two non-blocking follow-ups would strengthen this:
- cover the other two changed status-write error branches (CA bundle validation and authz/upstream validation), since the new regression test currently exercises only invalid AuthServerConfig;
- add explicit coverage for the trusted-issuer CA-bundle index path.
The ConfigMap-watch comments also still describe only incoming authz ConfigMaps even though the watch covers CA bundles too; worth updating when convenient.
None of these are blockers for this correctness/scalability fix.
Summary
provider/trusted-issuer CA bundles) listed every VirtualMCPServer in the
namespace and filtered in memory on each event — O(all VMCPs) work per
ConfigMap change. Replaced with a field index (
virtualMCPServerConfigMapIndex)queried via
client.MatchingFields.runAuthValidationslogged a failed status write(
applyStatusUpdates) and then returned as if the terminal validation hadcompleted cleanly, silently leaving the object's status stale/unwritten with
no retry. They now return the status-write error so controller-runtime
requeues with backoff.
Refs #6205 (SPIFFE client-auth epic) — this is a general reconciliation
correctness/scale fix, not scoped to that epic.
Type of change
Test plan
task test)Added
TestVirtualMCPServer_RunAuthValidations_StatusWriteFailurePropagates,which injects a failing status-subresource write via
interceptor.Funcsandasserts
runAuthValidationsreturns a non-nil error instead of(false, nil).Verified it fails against the pre-fix behavior and passes against the fix.
API Compatibility
v1beta1APIDoes this introduce a user-facing change?
No.
Generated with Claude Code