Skip to content

VirtualMCPServer: track OIDCConfigHash through statusManager instead of direct status update #4504

@ChrisJBurns

Description

@ChrisJBurns

Summary

In VirtualMCPServerReconciler.handleOIDCConfig, the OIDCConfigHash field is written directly via r.Status().Update(ctx, vmcp), while all other status fields in the VirtualMCPServer reconciler are buffered through the statusManager and flushed in a single batched applyStatusUpdates call.

This creates a mixed-write pattern: the direct update succeeds with one ResourceVersion, then the batched flush re-fetches and writes again. In practice this works because applyStatusUpdates re-fetches before writing, but a version conflict between the two writes would cause the hash update to be lost (recovered on requeue, but adds an unnecessary round-trip).

Ref: #4493 (comment)

Current behavior

// In handleOIDCConfig — direct write
vmcp.Status.OIDCConfigHash = oidcConfig.Status.ConfigHash
if err := r.Status().Update(ctx, vmcp); err != nil {
    return fmt.Errorf("failed to update MCPOIDCConfig hash in status: %w", err)
}

Desired behavior

Track OIDCConfigHash through the StatusManager like all other status fields. This requires adding a SetOIDCConfigHash(hash string) method to the StatusManager interface and its implementation in the StatusCollector.

Context

The MCPServer controller uses the same direct-update pattern for OIDCConfigHash, but MCPServer doesn't use a statusManager — it writes status directly throughout. The inconsistency is specific to VirtualMCPServer which adopted statusManager for batched updates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions