-
Notifications
You must be signed in to change notification settings - Fork 117
Reduce MCPServer CRD size by using runtime.RawExtension for PodTemplateSpec #2015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2015 +/- ##
==========================================
+ Coverage 48.17% 48.22% +0.04%
==========================================
Files 233 233
Lines 29229 29309 +80
==========================================
+ Hits 14082 14133 +51
- Misses 14111 14140 +29
Partials 1036 1036 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bf4a82f
to
c22bf13
Compare
aah, I approved based on reading the code :-) But in general the approach of not reconciling again if the podTemplateSpec is bad seems good to me. |
49c42de
to
4d28669
Compare
…teSpec The MCPServer CRD was too large (~9500 lines) to apply without server-side apply due to the embedded PodTemplateSpec taking up ~8500 lines. This was causing issues as reported in GitHub issue #2013. Changed the PodTemplateSpec field from a strongly-typed corev1.PodTemplateSpec to runtime.RawExtension, which stores the raw JSON without schema validation at the CRD level. This reduces the CRD size from ~9500 lines to 651 lines (93% reduction). The solution maintains full backwards compatibility - users can still use the same YAML structure. Validation now happens at runtime in the operator, with proper error handling via Kubernetes events and status conditions to notify users when invalid PodTemplateSpec data is provided. Key changes: - Modified MCPServer type to use runtime.RawExtension for PodTemplateSpec - Updated PodTemplateSpecBuilder to unmarshal and validate at runtime - Added event recording and status conditions for validation errors - Added comprehensive tests for invalid PodTemplateSpec scenarios - Fixed race conditions in parallel tests Fixes #2013
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
4d28669
to
cd7f211
Compare
The issue was that PodTemplateSpec validation was happening early and setting the PodTemplateValid condition, but then image validation was also setting the ImageValidated condition without persisting it to status. This caused the ImageValidated condition to overwrite the PodTemplateValid condition in subsequent status updates. The fix ensures that both validation conditions are persisted immediately after being set: - PodTemplateSpec validation updates status after setting condition - Image validation now also updates status after setting condition This ensures both conditions are present in the MCPServer status and the invalid-podtemplatespec e2e test will pass. Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
Summary
This PR addresses issue #2013 by significantly reducing the MCPServer CRD size from ~9500 lines to 651 lines (93% reduction).
Problem
The MCPServer CRD was too large (~9500 lines) to apply without server-side apply due to the embedded PodTemplateSpec taking up ~8500 lines. This was causing deployment issues as reported in #2013.
Solution
Changed the PodTemplateSpec field from a strongly-typed `corev1.PodTemplateSpec` to `runtime.RawExtension`, which stores the raw JSON without schema validation at the CRD level.
Key Benefits
Changes Made
Testing
Added comprehensive test coverage including:
Breaking Changes
None - this change maintains full backwards compatibility.
Fixes #2013