Add CRD type changes for horizontal scaling#4363
Conversation
7793327 to
8d79115
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7793327948
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4363 +/- ##
==========================================
+ Coverage 69.55% 69.57% +0.01%
==========================================
Files 480 482 +2
Lines 49109 49223 +114
==========================================
+ Hits 34159 34246 +87
- Misses 12310 12333 +23
- Partials 2640 2644 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the ToolHive operator CRD API surface to introduce horizontal-scaling foundations: replica controls on MCPServer/VirtualMCPServer plus a shared SessionStorageConfig (memory/redis) and regenerated deepcopy + CRD manifests.
Changes:
- Add
SessionStorageConfigand scaling fields (replicas,backendReplicas,sessionStorage) toMCPServerSpecandVirtualMCPServerSpec. - Regenerate CRD YAMLs (Helm templates + packaged CRDs) and
zz_generated.deepcopy.go. - Add unit + integration tests validating JSON serialization and CEL validation behavior for session storage and replicas.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/operator/crd-api.md | Regenerated CRD API docs reflecting new scaling + session storage fields. |
| cmd/thv-operator/api/v1alpha1/mcpserver_types.go | Adds scaling fields to MCPServerSpec and introduces SessionStorageConfig with CEL validation. |
| cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go | Adds scaling + session storage fields to VirtualMCPServerSpec. |
| cmd/thv-operator/api/v1alpha1/zz_generated.deepcopy.go | Regenerated deepcopy methods for new fields/types. |
| deploy/charts/operator-crds/templates/toolhive.stacklok.dev_mcpservers.yaml | Regenerated CRD Helm template to include new schema fields/validations. |
| deploy/charts/operator-crds/templates/toolhive.stacklok.dev_virtualmcpservers.yaml | Regenerated CRD Helm template to include new schema fields/validations. |
| deploy/charts/operator-crds/files/crds/toolhive.stacklok.dev_mcpservers.yaml | Regenerated packaged CRD manifest with new schema fields/validations. |
| deploy/charts/operator-crds/files/crds/toolhive.stacklok.dev_virtualmcpservers.yaml | Regenerated packaged CRD manifest with new schema fields/validations. |
| cmd/thv-operator/api/v1alpha1/mcpserver_types_test.go | Adds JSON roundtrip tests for SessionStorageConfig and MCPServerSpec scaling fields. |
| cmd/thv-operator/api/v1alpha1/virtualmcpserver_types_test.go | Adds JSON serialization tests for VirtualMCPServerSpec scaling/session storage fields. |
| cmd/thv-operator/test-integration/mcp-server/mcpserver_sessionstorage_cel_test.go | Integration tests verifying CEL validation for redis address + replicas acceptance. |
| cmd/thv-operator/test-integration/virtualmcp/virtualmcpserver_sessionstorage_cel_test.go | Integration tests verifying CEL validation for redis address + replicas acceptance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8d79115 to
652e872
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add SessionStorageConfig struct and scaling fields to MCPServer and VirtualMCPServer CRDs as the foundation for horizontal scaling support. - Add SessionStorageConfig struct with Provider, Address, DB, KeyPrefix, and PasswordRef fields; CEL rule enforces address is required for redis - Add Replicas *int32, BackendReplicas *int32, SessionStorage to MCPServerSpec - Add Replicas *int32, SessionStorage to VirtualMCPServerSpec - Nil pointer fields allow HPA to manage replicas without operator interference - Regenerate zz_generated.deepcopy.go and CRD manifests Closes: #4206
652e872 to
4a44795
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a44795 to
31e22a5
Compare
31e22a5 to
6788d84
Compare
Summary
Add SessionStorageConfig struct and scaling fields to MCPServer and VirtualMCPServer CRDs as the foundation for horizontal scaling support.
Fixes #4206
Type of change
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Special notes for reviewers