Skip to content

Add CRD type changes for horizontal scaling#4363

Merged
yrobla merged 2 commits intomainfrom
feat/thv-0047-crd-type-changes
Mar 26, 2026
Merged

Add CRD type changes for horizontal scaling#4363
yrobla merged 2 commits intomainfrom
feat/thv-0047-crd-type-changes

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Mar 25, 2026

Summary

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

Fixes #4206

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Mar 25, 2026
@yrobla yrobla force-pushed the feat/thv-0047-crd-type-changes branch from 7793327 to 8d79115 Compare March 25, 2026 11:12
@yrobla yrobla requested a review from Copilot March 25, 2026 11:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Mar 25, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.57%. Comparing base (3c7a3b0) to head (6788d84).
⚠️ Report is 7 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SessionStorageConfig and scaling fields (replicas, backendReplicas, sessionStorage) to MCPServerSpec and VirtualMCPServerSpec.
  • 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.

@yrobla yrobla force-pushed the feat/thv-0047-crd-type-changes branch from 8d79115 to 652e872 Compare March 25, 2026 11:24
@yrobla yrobla requested a review from Copilot March 25, 2026 11:24
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

jerm-dro
jerm-dro previously approved these changes Mar 25, 2026
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
@yrobla yrobla force-pushed the feat/thv-0047-crd-type-changes branch from 652e872 to 4a44795 Compare March 26, 2026 08:16
@yrobla yrobla requested review from Copilot and jerm-dro March 26, 2026 08:16
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Mar 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

JAORMX
JAORMX previously approved these changes Mar 26, 2026
@yrobla yrobla force-pushed the feat/thv-0047-crd-type-changes branch from 4a44795 to 31e22a5 Compare March 26, 2026 09:51
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Mar 26, 2026
@yrobla yrobla force-pushed the feat/thv-0047-crd-type-changes branch from 31e22a5 to 6788d84 Compare March 26, 2026 10:12
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Mar 26, 2026
@yrobla yrobla merged commit 9c8f5ec into main Mar 26, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRD type changes and manifest regeneration for MCPServer and VirtualMCPServer scaling

5 participants