-
Notifications
You must be signed in to change notification settings - Fork 149
Add PVC source support for MCPRegistry #2719
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2719 +/- ##
==========================================
- Coverage 55.59% 55.58% -0.01%
==========================================
Files 314 314
Lines 30445 30483 +38
==========================================
+ Hits 16925 16945 +20
- Misses 12033 12050 +17
- Partials 1487 1488 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dmartinol
left a comment
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.
Thanks for your contribution!
I commented with some concerns about using the configured values, please TAL!
| if r.Spec.Source.PVCRef == nil { | ||
| return "registry.json" | ||
| } | ||
|
|
||
| if r.Spec.Source.PVCRef.Path == "" { | ||
| return "registry.json" | ||
| } |
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.
can we collapse these to a single if check?
if r.Spec.Source.PVCRef == nil || r.Spec.Source.PVCRef.Path == ""
| // this stops the registry server worrying about PVC sources when all it has to do | ||
| // is read the file on startup | ||
| sourceConfig.File = &FileConfig{ | ||
| Path: filepath.Join(RegistryJSONFilePath, RegistryJSONFileName), |
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.
instead of the constant RegistryJSONFileName, shouldn't we return the configured value at registrySpec.PvvcRef.Key?
in case, pls add a proper test to validate
BTW: I see that the same constant is returned when a ConfigMap is defined , we need to track with an issue and fix
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.
I've added #2749
| // The custom path is handled by the volume mount, not the config | ||
| assert.Equal(t, SourceTypeFile, config.Source.Type) | ||
| require.NotNil(t, config.Source.File) | ||
| assert.Equal(t, filepath.Join(RegistryJSONFilePath, RegistryJSONFileName), config.Source.File.Path) |
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.
this should instead return the custom path custom/path/registry.json
| # Example Job to populate the PVC with registry data | ||
| # This job can be run once to initialize the PVC, or periodically to update it | ||
| apiVersion: batch/v1 | ||
| kind: Job |
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.
good job 👍
|
Need some adjustment to adapt to the new model:
|
822def6 to
27c80e2
Compare
Enables MCPRegistry resources to use PersistentVolumeClaims as a data source in addition to existing ConfigMap, Git, and API sources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Jon Burdo <[email protected]>
|
|
||
| // RegistrySourceTypePVC is the type for registry data stored in PersistentVolumeClaims | ||
| RegistrySourceTypePVC = "pvc" | ||
| ) |
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.
This constant and also the others above can be safely removed IMO (missed to drop them in another cleanup task): can you pls remove all the const block?
| pvcPath := RegistryJSONFileName | ||
| if registrySpec.PVCRef.Path != "" { | ||
| pvcPath = registrySpec.PVCRef.Path | ||
| } |
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.
Try using the buildFilePath function instead, to include the registry name in the path (otherwise we could have duplicated file paths in the server config)
| assert.Equal(t, mcpv1alpha1.RegistryFormatToolHive, config.Registries[0].Format) | ||
| require.NotNil(t, config.Registries[0].File) | ||
| // Path defaults to registry.json at PVC root | ||
| assert.Equal(t, filepath.Join(RegistryJSONFilePath, RegistryJSONFileName), config.Registries[0].File.Path) |
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.
after the above change, the expected path includes the registry name
dmartinol
left a comment
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.
Please take a look at the REGISTRY.md file to include the new registry type (BTW: if you can, please also replace the "data sources" to "registries", it's another leftover of previous PRs
Enables MCPRegistry resources to use PersistentVolumeClaims as a data source in addition to existing ConfigMap, Git, and API sources.
🤖 Generated with Claude Code