Skip to content
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

Catalog content discovery #2782

Conversation

eusebiu-constantin-petu-dbk
Copy link
Collaborator

What type of PR is this?

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 83.58974% with 32 lines in your changes missing coverage. Please review.

Project coverage is 91.88%. Comparing base (5e30fec) to head (7afee3d).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pkg/extensions/sync/remote.go 31.81% 14 Missing and 1 partial ⚠️
pkg/storage/imagestore/imagestore.go 82.81% 8 Missing and 3 partials ⚠️
pkg/api/authz.go 66.66% 2 Missing and 1 partial ⚠️
pkg/api/routes.go 96.15% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2782      +/-   ##
==========================================
- Coverage   91.93%   91.88%   -0.06%     
==========================================
  Files         170      170              
  Lines       30126    30282     +156     
==========================================
+ Hits        27697    27824     +127     
- Misses       1806     1829      +23     
- Partials      623      629       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@uvegla
Copy link

uvegla commented Nov 15, 2024

I gave it a try and found some problem I think. I updated the original issue: #2715 (comment) and will take a deeper look.

@rchincha
Copy link
Contributor

Also be mindful about access control - one may not have read access to all repos.

@eusebiu-constantin-petu-dbk
Copy link
Collaborator Author

eusebiu-constantin-petu-dbk commented Nov 23, 2024

@uvegla Thank you very much for your work on this!
Can you try it again please?

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the catalog_content_discovery branch 8 times, most recently from 5ae5b92 to 9302fc6 Compare November 23, 2024 19:15
feat(api): added /v2/_catalog pagination, fixes project-zot#2715

Signed-off-by: Eusebiu Petu <[email protected]>
sort.Strings(subPaths)

storePath := rh.c.StoreController.GetStorePath(lastEntry)
if storePath == storage.DefaultStorePath {
Copy link
Contributor

Choose a reason for hiding this comment

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

So the entries are not sorted by names? The default store entries are always first?


subStore := rh.c.StoreController.SubStore

subPaths := make([]string, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add more comments? It's a bit hard to follow the logic of this function.
Are there assumptions being made about the order of the substores relative to the default store?

This spec https://github.com/openshift/docker-distribution/blob/master/docs/spec/api.md#pagination mentions "The catalog result set is represented abstractly as a lexically sorted list,"

How would the logic behave if I have a substore for folder /b/ and another for folder /d/?
Repos /a/ are supposed to be first from the default store followed from repos /b/ from the 1st substore, followed by repos /c/ from the default store, followed by repos /d/ from the 2nd substore, followed by repos /e/ from the default strore...
Of course you could have cases such as /aa/, /ab/, and other folders.

We may agree that in out zot implementation we don't care about lexical sorting, since _catalog is not part or the oci dist spec, but in this case let's make that clear in the code/comments/docs?

img := CreateRandomImage()

repoNames := []string{
"alpine1", "alpine2", "alpine3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we mix them so the results from the default store and substores are not in alphabetical order?

Let's say substores with paths /a and /c, and images "alpine1", "alpine2", "alpine3", "a/alpine4", "a/alpine5", "a/alpine6", "b/alpine7", "b/alpine8", "b/alpine9", "c/alpine10", "c/alpine11", "c/alpine12", "d/alpine10", "d/alpine11", "d/alpine12". Also some entries not having a folder in path.

@uvegla
Copy link

uvegla commented Nov 27, 2024

Tested locally, looks good to me now! 🙂 Thank you for working on this! 👍🏻

@rchincha
Copy link
Contributor

@eusebiu-constantin-petu-dbk can you take a look at @andaaron 's comments?

@rchincha rchincha merged commit 772e90a into project-zot:main Dec 19, 2024
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants