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 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.51%. Comparing base (8dae561) to head (9f9e23b).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...md/thv-operator/pkg/registryapi/podtemplatespec.go 91.30% 2 Missing ⚠️
cmd/thv-operator/pkg/registryapi/config/config.go 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2719      +/-   ##
==========================================
- Coverage   56.53%   56.51%   -0.03%     
==========================================
  Files         319      319              
  Lines       30885    30917      +32     
==========================================
+ Hits        17462    17473      +11     
- Misses      11930    11951      +21     
  Partials     1493     1493              

☔ 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 3 times, most recently from 27c80e2 to 632f5b0 Compare November 27, 2025 03:59
@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 +348
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

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 <noreply@anthropic.com>
Signed-off-by: Jon Burdo <jon@jonburdo.com>
@jonburdo
Copy link
Author

jonburdo commented Dec 1, 2025

A few notes:

  • I changed the mount path to simply use the pvc claim name instead of registry name ({RegistryJSONFilePath}/{claimName}/) for the mount path, since a single pvc could contain multiple registry files.
  • I suggest switching "source" to "registry" in a followup to narrow the scope. I'm happy to do this - tracked in Rename Source to Registry #2815

@github-actions github-actions bot removed the size/L Large PR: 600-999 lines changed label Dec 1, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants