-
Notifications
You must be signed in to change notification settings - Fork 132
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
Open
JAORMX
wants to merge
6
commits into
main
Choose a base branch
from
fix/mcpserver-crd-size-reduction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2015 +/- ##
==========================================
+ Coverage 53.06% 53.07% +0.01%
==========================================
Files 223 223
Lines 29057 29143 +86
==========================================
+ Hits 15418 15467 +49
- Misses 12512 12549 +37
Partials 1127 1127 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jhrozek
reviewed
Sep 26, 2025
bf4a82f
to
c22bf13
Compare
jhrozek
previously approved these changes
Sep 29, 2025
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. |
4d28669
to
cd7f211
Compare
0401195
to
ac354b1
Compare
160cd36
to
58d7698
Compare
ChrisJBurns
reviewed
Oct 15, 2025
cmd/thv-operator/controllers/mcpserver_podtemplatespec_invalid_test.go
Outdated
Show resolved
Hide resolved
...ingle-tenancy/test-scenarios/invalid-podtemplatespec/assert-mcpserver-invalid-condition.yaml
Outdated
Show resolved
Hide resolved
4930ac2
to
e2038fb
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
Replace unreliable Chainsaw assertion with explicit kubectl check for deployment non-existence. The test now uses a bash script to verify that no deployment is created when an invalid PodTemplateSpec is provided. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Signed-off-by: Juan Antonio Osorio <[email protected]>
- Remove redundant reconciliation skip log (already logged in validation) - Remove verbose logging for successful PodTemplateSpec validation - Merge invalid PodTemplateSpec unit tests into builder test file - Add integration test for invalid PodTemplateSpec scenario - Remove redundant e2e test (replaced by integration test) The validation function already logs errors and generates events, so the additional log in the reconcile loop was redundant. Integration tests provide better coverage than e2e tests for this scenario. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add nil check for Recorder before calling Eventf to prevent panic - Update TestDeploymentArgsWithInvalidPodTemplateSpec to match configmap mode behavior The Recorder can be nil in test environments, causing a panic when trying to record events. The deployment args test was checking for flags that only exist in non-configmap mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
0831563
to
8a1d9d2
Compare
This chart version bump is required due to the MCPServer CRD changes that modify the PodTemplateSpec field from corev1.PodTemplateSpec to runtime.RawExtension, reducing CRD size by 8000+ lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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