Migrate Remaining VirtualMCPServer Fields to spec.config#3242
Migrate Remaining VirtualMCPServer Fields to spec.config#3242
Conversation
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
aab783d to
aa239d9
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3242 +/- ##
==========================================
+ Coverage 63.66% 63.70% +0.04%
==========================================
Files 362 362
Lines 35521 35209 -312
==========================================
- Hits 22613 22431 -182
+ Misses 11089 10974 -115
+ Partials 1819 1804 -15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
eba9fb7 to
bc234ad
Compare
bc234ad to
261757d
Compare
Add documentation clarifying the relationship between VirtualMCPServerSpec.IncomingAuth and config.Config.IncomingAuth: - Update spec.IncomingAuth comment to explain it takes precedence over config.IncomingAuth and should be preferred because it supports Kubernetes-native secret references (SecretKeyRef, ConfigMapRef) for secure dynamic discovery of credentials - Mark config.IncomingAuth as optional with +optional annotation since the CRD's spec.IncomingAuth is the authoritative source when using the operator - Add note to config.IncomingAuthConfig explaining that when using the Kubernetes operator, the converter populates this field from VirtualMCPServerSpec.IncomingAuth and any values set directly will be superseded - Regenerate CRD manifests and API documentation Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Add documentation clarifying the relationship between VirtualMCPServerSpec auth fields and their config.Config equivalents: - Update spec.IncomingAuth and spec.OutgoingAuth comments to explain they take precedence over their config counterparts and should be preferred because they support Kubernetes-native secret references (SecretKeyRef, ConfigMapRef) for secure dynamic discovery of credentials - Mark config.IncomingAuth and config.OutgoingAuth as optional with +optional annotation since the CRD spec fields are the authoritative source when using the operator - Add notes to config.IncomingAuthConfig and config.OutgoingAuthConfig explaining that when using the Kubernetes operator, the converter populates these fields from VirtualMCPServerSpec and any values set directly will be superseded - Regenerate CRD manifests and API documentation Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
….config Move the Aggregation field and its associated types from the CRD spec into the nested config.Config structure for consistency with the platform-agnostic configuration model. Changes: - Delete AggregationConfig, ConflictResolutionConfig, WorkloadToolConfig types from api/v1alpha1 (ToolOverride kept for MCPToolConfig) - Delete conflict resolution constants from CRD spec (use pkg/vmcp constants) - Add kubebuilder annotations and comments to config.AggregationConfig - Add ToolConfigRef support to config.WorkloadToolConfig for K8s references - Update converter to copy and resolve config.Aggregation with defaults - Update webhook validation to use vmcp.ConflictStrategy* constants - Update controller to check vmcp.Spec.Config.Aggregation for ToolConfigRef - Update all examples to use spec.config.aggregation path - Update Chainsaw tests and e2e tests for new structure - Regenerate CRD manifests and API documentation BREAKING CHANGE: VirtualMCPServer resources must now specify aggregation under spec.config.aggregation instead of spec.aggregation Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
261757d to
990efa5
Compare
990efa5 to
1252486
Compare
08a671e to
e0a3752
Compare
Fixed two test failures: 1. Chainsaw test (vmcp-composite-tool-definition): - Removed 'failureMode' field from VirtualMCPCompositeToolDefinition spec - Field was deleted in commit 7525cc8 when CRD was refactored to embed config.CompositeToolConfig - Test now passes successfully 2. Ginkgo test (virtualmcp_telemetry_test): - Fixed ConfigMap name from '{name}-config' to '{name}-vmcp-config' - Matches the actual naming convention used by vmcpConfigMapName() function - Test now correctly retrieves and validates telemetry configuration Both tests verified passing with local operator deployment: - Chainsaw vmcp-composite-tool-definition: PASS (9.03s) - Ginkgo VirtualMCPServer Telemetry Config: PASS (27.26s)
test/e2e/chainsaw/operator/single-tenancy/test-scenarios/vmcp/chainsaw-test.yaml
Show resolved
Hide resolved
jhrozek
left a comment
There was a problem hiding this comment.
I only had some nits. Since this is a very large PR, feel free to ignore and merge, I'm acking
This PR addresses several goals: Configuration Consolidation: Move CRD-specific fields into config.Config to eliminate duplication and establish a single source of truth Validation Unification: Consolidate scattered validation logic into shared, reusable functions Type Simplification: Remove redundant CRD-to-config conversion functions by embedding config types directly in CRDs Bug Fixes: Fix telemetry config field loss during CRD conversion Documentation: Clarify field precedence and add proper kubebuilder annotations --------- Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Summary
This PR completes the migration of VirtualMCPServer CRD fields from the top-level spec into the nested
spec.configstructure, aligning with the platform-agnostic configuration model and consolidating validation logic.Fixes #3125
Large PR Justification
Please review this PR commit-by-commit (10 commits total). Each commit is self-contained with its own tests, documentation updates, and CRD regeneration. The changes build upon each other progressively.
Changes
This PR addresses several goals:
config.Configto eliminate duplication and establish a single source of truthCommit-by-Commit Breakdown
1.
b1c52a3- docs(vmcp): clarify IncomingAuth precedence between CRD spec and configWhat: Documentation-only change
spec.IncomingAuthtakes precedence overconfig.IncomingAuthconfig.IncomingAuthas optional since CRD field is authoritative2.
d37a88f- docs(vmcp): clarify auth config precedence between CRD spec and configWhat: Extends auth documentation to outgoing auth
OutgoingAuthfields3.
39f6357- feat(operator): migrate Aggregation from VirtualMCPServerSpec to spec.configWhat: Moves
Aggregationfield tospec.configAggregationConfig,ConflictResolutionConfig,WorkloadToolConfigfrom CRD typesconfig.AggregationConfigspec.config.aggregationpath4.
6de62aa- refactor(operator): migrate CompositeTools and CompositeToolRefs to spec.configWhat: Moves composite tool definitions to
spec.configCompositeToolSpecfrom VirtualMCPServer CRDCompositeToolReftype topkg/vmcp/configfor Kubernetes references[]*T→[]T)5.
7525cc8- refactor(operator): embed config.CompositeToolConfig in VirtualMCPCompositeToolDefinitionSpecWhat: Simplifies VirtualMCPCompositeToolDefinition CRD structure
config.CompositeToolConfigdirectly instead of duplicating types6.
0e5ca70- refactor(validation): consolidate composite tool validation in pkg/vmcp/configWhat: Centralizes all composite tool validation logic
pkg/vmcp/config/composite_validation.gowith shared functionsworkflow_validation.gofrom v1alpha1 package7.
63bbc2a- refactor(operator): migrate Operational config from spec to spec.configWhat: Moves
Operationalfield tospec.configLogLevelfield toconfig.OperationalConfig8.
82c92d2- fix(telemetry): add optional annotations and defaults to telemetry.ConfigWhat: Improves telemetry configuration ergonomics
ServiceName,ServiceVersion, andEndpointoptionalTracingEnabled:falseMetricsEnabled:falseSamplingRate:"0.05"Insecure:falseEnablePrometheusMetricsPath:false9.
3b9e20d- fix(operator): preserve all telemetry config fields during CRD conversionWhat: Fixes critical bug in telemetry config conversion
CustomAttributes,ServiceVersion,EnvironmentVariableswere silently droppedspectoconfig.NormalizeTelemetryConfig()as shared normalization logicTestConverter_TelemetryConfigPreserved- field preservationTestConverter_TelemetryDefaults- default behaviorTestConverter_TelemetryEndpointPrefixStripping- normalizationTestNormalizeTelemetryConfig- 8 test casesTestConvertTelemetryConfig_UsesNormalization- integrationvirtualmcp_telemetry_test.go10.
49b9da0- chore: bump operator-crds chart version to 0.0.95 and regenerate docsWhat: Version bump and final regeneration
0.0.94to0.0.95