Skip to content

Conversation

@jonburdo
Copy link

@jonburdo jonburdo commented Nov 25, 2025

Enables MCPRegistry resources to use PersistentVolumeClaims as a data source in addition to existing ConfigMap, Git, and API sources.

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 52.63158% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.58%. Comparing base (7e2a5e7) to head (7e4f733).

Files with missing lines Patch % Lines
cmd/thv-operator/pkg/registryapi/manager.go 0.00% 17 Missing and 1 partial ⚠️
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.
📢 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
Collaborator

@dmartinol dmartinol left a 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!

Comment on lines 461 to 467
if r.Spec.Source.PVCRef == nil {
return "registry.json"
}

if r.Spec.Source.PVCRef.Path == "" {
return "registry.json"
}
Copy link
Collaborator

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),
Copy link
Collaborator

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

Copy link
Author

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)
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

good job 👍

@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Nov 25, 2025
@dmartinol
Copy link
Collaborator

Need some adjustment to adapt to the new model:

  • naming review
  • multiple registries (FKA source)
    The latter implies that the mounted path should use the regisstry name to create a sub-folder.
    Finally, it would be great if you can extend the existing IT with this use case (maybe having a config with both ConfigMap and PVC)

@jonburdo jonburdo marked this pull request as draft November 26, 2025 03:27
@jonburdo jonburdo force-pushed the pvc-source branch 2 times, most recently from 822def6 to 27c80e2 Compare November 27, 2025 00:25
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]>
@jonburdo jonburdo marked this pull request as ready for review November 27, 2025 04:02
Comment on lines +19 to 22

// RegistrySourceTypePVC is the type for registry data stored in PersistentVolumeClaims
RegistrySourceTypePVC = "pvc"
)
Copy link
Collaborator

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?

Comment on lines +298 to +301
pvcPath := RegistryJSONFileName
if registrySpec.PVCRef.Path != "" {
pvcPath = registrySpec.PVCRef.Path
}
Copy link
Collaborator

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)
Copy link
Collaborator

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

Copy link
Collaborator

@dmartinol dmartinol left a 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

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.

2 participants