-
Notifications
You must be signed in to change notification settings - Fork 156
feat(operator): Add MCPServer restart annotation support #1882
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
feat(operator): Add MCPServer restart annotation support #1882
Conversation
There was a problem hiding this 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 adds restart functionality for MCPServer pods through annotations, enabling users to trigger graceful restarts via GitOps workflows without requiring CRD schema changes.
- Implements restart annotation support with two strategies: rolling (zero-downtime) and immediate (fast restart)
- Adds comprehensive test coverage for restart functionality with various scenarios
- Provides documentation and examples for the new restart annotation feature
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/thv-operator/controllers/mcpserver_controller.go | Core restart functionality implementation with annotation handling and restart strategies |
| cmd/thv-operator/controllers/mcpserver_restart_test.go | Comprehensive test suite covering restart annotation handling scenarios |
| docs/operator/restart-annotation.md | Complete documentation for the restart annotation feature |
| examples/operator/mcp-servers/mcpserver_with_restart_strategy.yaml | Example configuration showing restart annotation usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
31ece55 to
48f0b58
Compare
There was a problem hiding this 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 4 out of 4 changed files in this pull request and generated 6 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
82bc708 to
0db71b2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1882 +/- ##
==========================================
+ Coverage 46.59% 46.91% +0.31%
==========================================
Files 220 220
Lines 27201 27319 +118
==========================================
+ Hits 12674 12816 +142
+ Misses 13567 13528 -39
- Partials 960 975 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The functionality LGTM! Seems you gotta fix the linter warnings and then it's good to go. Thanks a lot for taking a look at this @olamide226 ! |
0db71b2 to
0e277a0
Compare
…iate strategies - Implement restart trigger via mcpserver.toolhive.stacklok.dev/restarted-at annotation (RFC3339 timestamp) - Support optional mcpserver.toolhive.stacklok.dev/restart-strategy annotation (rolling or immediate) - Rolling strategy updates deployment for zero-downtime restart (default) - Immediate strategy deletes pods for fast restart - Track last processed restart in status.lastRestartRequest to prevent duplicate restarts - Update docs and examples to reflect new annotation format and usage Signed-off-by: Ola Adebayo <34113844+olamide226@users.noreply.github.com>
…iliation Add first test suite for MCPServer restart annotation logic in the operator controller. Covers rolling and immediate restart strategies, including edge cases (invalid timestamp, already processed, missing resources, unknown strategy). Signed-off-by: Ola Adebayo <34113844+olamide226@users.noreply.github.com>
Add restart functionality via annotations without CRD schema changes: - Support mcpserver.toolhive.stacklok.dev/restarted-at annotation (RFC3339 timestamp) - Support mcpserver.toolhive.stacklok.dev/restart-strategy annotation (rolling/immediate) - Rolling strategy triggers zero-downtime deployment update (default) - Immediate strategy deletes pods for fast restart - Track last processed restart in annotations to prevent duplicates - Update documentation and examples for new annotation usage Resolves operator restart requirements while maintaining backward compatibility. Signed-off-by: Ola Adebayo <34113844+olamide226@users.noreply.github.com>
… handling Signed-off-by: Ola Adebayo <olamideadebayo2001@gmail.com>
b20b6ef to
49d4fd5
Compare
Summary
Adds restart functionality for MCPServer pods via annotations without requiring CRD schema changes. This feature enables users to trigger graceful restarts of MCPServer instances through GitOps workflows and operational commands.
Changes Made
New Restart Annotations:
mcpserver.toolhive.stacklok.dev/restarted-at- RFC3339 timestamp to trigger restartmcpserver.toolhive.stacklok.dev/restart-strategy- Optional strategy selection ("rolling" or "immediate")mcpserver.toolhive.stacklok.dev/last-processed-restart- Internal tracking (set by operator)Two Restart Strategies:
Non-blocking Error Handling: Invalid annotations or operational failures don't prevent other reconciliation tasks (ToolConfig updates, spec changes, etc.)
Duplicate Prevention: Tracks last processed restart timestamp to avoid reprocessing same requests
Usage Examples
ref #1880