-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Provide stat descriptor for Create method during cross-repo mount #1857
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
Provide stat descriptor for Create method during cross-repo mount #1857
Conversation
8ca6ba8
to
664ec13
Compare
@GordonTheTurtle wins the first round. |
/cc-ing my favorite victims @stevvooe @RichardScothern Sorry for asking you to go through this once again. It would really help us. |
Current coverage is 52.60% (diff: 100%)@@ master #1857 diff @@
==========================================
Files 74 120 +46
Lines 6910 10515 +3605
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 3801 5531 +1730
- Misses 2633 4243 +1610
- Partials 476 741 +265
|
664ec13
to
13371a3
Compare
Kudos to @liggitt who found a much less intrusive change. Basically, the middleware just passes a blob descriptor to the |
13371a3
to
efa7622
Compare
@@ -198,6 +198,7 @@ type CreateOptions struct { | |||
Mount struct { | |||
ShouldMount bool | |||
From reference.Canonical | |||
Stat *Descriptor |
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.
Could you document the role of this field?
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.
Could you document the role of this field?
Sure, done.
Clever. Presumably, the access control is maintained at a higher level? |
Signed-off-by: Michal Minář <[email protected]>
Signed-off-by: Michal Minář <[email protected]>
efa7622
to
c5105cc
Compare
Correct, repository access check is done in access control and the blob access check in repository middleware. Both query etcd. |
👍 to this approach. |
LGTM |
…stribution#1857) * Allow precomputed stats on cross-mounted blobs Signed-off-by: Michal Minář <[email protected]> * Extended cross-repo mount tests Signed-off-by: Michal Minář <[email protected]>
…stribution#1857) * Allow precomputed stats on cross-mounted blobs Signed-off-by: Michal Minář <[email protected]> * Extended cross-repo mount tests Signed-off-by: Michal Minář <[email protected]>
In distribution#1857, it was made possible for middlewares to have the blob store perform cross-mounts. As far as I know, there was only one middleware using this, Openshift. It was removed from the openshift registry in: openshift/image-registry@a0ac6ff In the future, the cross-mount can be performed using automatic blob discovery. Signed-off-by: Sargun Dhillon <[email protected]>
In OpenShift, there's a pullthroughBlobStore middleware wrapper that acts like a proxy. It allows to pull blobs from remote registries based on per-repository configuration stored in etcd.
During a cross-repo mount, the linkedBlobStore stats requested blob in the source repository. The repository object used for it doesn't have middleware wrappers, therefore it's impossible to override this behaviour.
With the CreateOptions exposed we are able to intercept the request and handle it in custom way. However, we still need to create the layer link for a successful mount. Sadly, this operation is private.
It's true we could handle this completely on our side (without creating and stat-ing repository links) since we already store most of the metadata in etcd. Unfortunately we're not there yet.
This PR adds a
Stat
attribute to the create mount options that contains precomputed descriptor that shall be returned byCreate
method. If set,linkedBlobStore
won't do its ownStat
call to ensure the presence of the blob.