Repository navigation
DO NOT MERGE: Support dynamic fallback down registry chains - #1021
smarterclayton wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f2a7bf6 to
2784354
Compare
dmage
left a comment
There was a problem hiding this comment.
Honestly I don't like that it lookups alternatives from scratch from every method. If I want to pull (mirror) an image, I want to get all its blobs from the same repository. Most likely it'll be the first suggested repository and this approach will work, but what if the first mirror is down?
Otherwise, looks good, nice catch that write methods shouldn't use mirrors.
|
|
||
| func (f mirroredTags) Get(ctx context.Context, tag string) (distribution.Descriptor, error) { | ||
| var desc distribution.Descriptor | ||
| err := f.repo.source(ctx, func(r distribution.Repository) error { |
There was a problem hiding this comment.
We never trust mirrored tags?
There was a problem hiding this comment.
no because you don't know whether they are in sync. I think that would be a different type of behavior - we could call this "blobMirrored" to clarify because everything has to be content addressable.
There was a problem hiding this comment.
Renamed to make it a bit clearer and updated the godoc on the top most item.
There was a problem hiding this comment.
i've been stuck I've incorporated this but when I run 'oc image mirror anything' I see a manifest blob unknown error w/ the manifests Put. - If I don't fix this I'll push my oc branch w/ the bump and have you try it/help tomorrow. (first I'll incorporate the name changes above)
There was a problem hiding this comment.
ooooh got it to work - oc was considering a nil manifest and an empty Descriptor as 'already existing' once I fixed that the push goes through.. now, why is the regclient returning a nil manifest and empty Descriptor?
|
|
||
| // initialRepos returns a list of locations to attempt to access, a boolean indicating that alternates | ||
| // were suggested, or an error. | ||
| func (r *mirroredRepository) initialRepos(ctx context.Context) ([]reference.DockerImageReference, bool, error) { |
There was a problem hiding this comment.
You can safely ditch this bool without sacrificing performance/readability.
There was a problem hiding this comment.
It's subtle and necessary - the presence of the bool tells us whether the FirstRequest() gave us alternates or not. If it did, we never call OnFailure(). If it doesn't, we have to call OnFailure later. The difference is because the returned list of alternates always contains the source in the default path, so an empty alternates list (or nil) doesn't tell us what expected outcome from FirstRequest was().
| return err | ||
| } | ||
| if alternateErr := r.attemptRepos(ctx, alternates, fn); alternateErr != nil { | ||
| return err |
There was a problem hiding this comment.
yikes good catch.
There was a problem hiding this comment.
renamed it attemptErr
| }) | ||
|
|
||
| klog.InitFlags(flag.CommandLine) | ||
| //cliflag.InitFlags() |
There was a problem hiding this comment.
Was just hacking it in while i debugged code, would not go in to final.
It should only lookup alternatives one time per Repository() object returned from the main call (maybe a bug if I'm looking wierdly) |
2784354 to
3664d6b
Compare
Implements the core of the discussion around supporting multiple sources of input. Each wrapped method in the mirroredRepository structure that needs to check alternates (methods that invoke digest lookups) will use that structure. Methods that cannot be retried will use the first alternative that has a working client (such as ServeBlob). Methods that must always use the source (mutable calls or those that don't deal with a digest) will only look at the original source, although the logic is structured so we can use data about these requests in the future. The strategy is clarified to call either FirstRequest and OnFailure, or just FirstRequest. Each repository will make a single call to the strategy, and it's up to the strategy to include the original source when invoking FirstRequest. Did a very, very, very minimal test of this against docker.io but did not check anything except get.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
|
@smarterclayton: PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
|
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
|
@openshift-bot: Closed this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Implements the core of the discussion around supporting multiple
sources of input. Each wrapped method in the mirroredRepository
structure that needs to check alternates (methods that invoke digest
lookups) will use that structure. Methods that cannot be retried
will use the first alternative that has a working client (such as
ServeBlob). Methods that must always use the source (mutable calls
or those that don't deal with a digest) will only look at the
original source, although the logic is structured so we can use
data about these requests in the future.
The strategy is clarified to call either FirstRequest and OnFailure,
or just FirstRequest. Each repository will make a single call to the
strategy, and it's up to the strategy to include the original source
when invoking FirstRequest.
Did a very, very, very minimal test of this against docker.io but
did not check anything except get.