-
Notifications
You must be signed in to change notification settings - Fork 363
(Feat) Disable mcpServer reconciliation via kagent.dev/discovery-disabled annotation
#856
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) Disable mcpServer reconciliation via kagent.dev/discovery-disabled annotation
#856
Conversation
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
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 implements a feature to disable reconciliation of mcpServer CRDs by introducing a kagent.dev/discovery-disabled annotation. When set to "true", the controller will skip processing these resources.
- Added a new predicate to filter out resources with the discovery disabled annotation
- Integrated the predicate into the MCPServerController setup
- Added comprehensive tests covering all event types and annotation scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/internal/controller/predicates/discovery_disabled.go | New predicate implementation that filters resources based on discovery-disabled annotation |
| go/internal/controller/predicates/discovery_disabled_test.go | Test coverage for the discovery disabled predicate functionality |
| go/internal/controller/mcp_server_controller.go | Integration of the new predicate into the controller setup |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Just a comment here. I'd love to see consistency in the way that secondary resources are discovered. It feels weird to me that |
Interesting. I think the concept here is that this is in fact a primary resource, but I do see what you’re saying. Why would you consider this a secondary resource? |
Hopefully, the contributor's meeting cleared this up. But for the sake of posterity and a wider audience, I'll comment here as well... I see this as a secondary resource because the CRD is not owned by this project. It belongs to KMCP as does the controller that reconciles it (related to #822). |
Great thoughts @onematchfox! We are also interested in looking at merging kmcp as an optional component in kagent which would make MCPServer as first citizen resource in kagent. |
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
| expected: true, | ||
| }, | ||
| { | ||
| name: "discovery label set to disabled - should not process", |
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.
What happens in the case of a resource that has already been discovered? Will this prevent it from being "undiscovered"?
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.
That is a great question. There's really no surefire way to catch this without checking every single time which feels like overkill. What do you think about a doc explaining how to remove the old entries for now?
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.
There's really no surefire way to catch this without checking every single time which feels like overkill.
Actually, I think there is a better way of handling this. The update handler on the predicate has access to both the old (e.ObjectOld) and new (e.ObjectNew) versions of the object. So, rather than only checking the discovery configuration on the new object (!isDiscoveryDisabled(e.ObjectNew)) the controller should check both the old and the new versions and process any object where either of them do not have discovery disabled. That way, the controller is able to handle objects where discovery is disabled on an existing object and ensure that the tool server is removed.
…abled` annotation (kagent-dev#856) This PR enables disabling reconciliation of `mcpServer` CRDs that explicitly set the `kagent.dev/discovery-disabled=true` annotation. Resolves kagent-dev#853 --------- Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io> Signed-off-by: krisztianfekete <git@krisztianfekete.org>
…abled` annotation (kagent-dev#856) This PR enables disabling reconciliation of `mcpServer` CRDs that explicitly set the `kagent.dev/discovery-disabled=true` annotation. Resolves kagent-dev#853 --------- Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io> Signed-off-by: krisztianfekete <git@krisztianfekete.org>
This PR enables disabling reconciliation of
mcpServerCRDs that explicitly set thekagent.dev/discovery=disabledlabel.Resolves #853