Skip to content

Alternate lookups - #1084

Merged
openshift-merge-robot merged 3 commits into
openshift:masterfrom
soltysh:alternate_lookups
Jun 2, 2021
Merged

openshift-merge-robot merged 3 commits into
openshift:masterfrom
soltysh:alternate_lookups

Conversation

@soltysh

@soltysh soltysh commented May 20, 2021 •

Copy link
Copy Markdown

Simplified version of #939 as discussed with @smarterclayton

/assign @smarterclayton

The initial take in oc lives in openshift/oc#829

return []reference.DockerImageReference{r.locator.ref}, false, nil
}

r.lock.Lock()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is concerning - why did you make this change? This prevents multiple FirstRequests being called, so I didn't expect it to be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yeah, I think that's coming from the fact that Sally added errorRepos below but analyzing that again, it doesn't make sense, since we have higher-level methods responsible for calling errorRepos, I'll also update the comments with that information

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

right, calling errorRepos from initialRepos there was a deadlock-there was limited context with use of FirstRequest, it's simply returned/not used w/ oc & image-registry, so i left the lock in errorRepos since that's where oc required it- wasn't foreseeing multiple FirstRequests - not calling errorRepos & returning the method's ref instead has the same result and is more appropriate.

Comment thread pkg/image/registryclient/client.go Outdated
// Repository returns a properly authenticated distribution.Repository for the given registry, repository
// name, and insecure toleration behavior.
Repository(ctx context.Context, registry *url.URL, repoName string, insecure bool) (distribution.Repository, error)
Repository(ctx context.Context, registry *url.URL, repoName string, insecure bool) (RepositoryWithLocation, error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you link to where this is required (use case in oc)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I went through all the possible places and I'm not seeing any particular cases, yet. I'll revert that bit back as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this was requested by image-registry (@ricardomaraschini ) they use this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Image registry uses the RepositoryRetriever interface.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Right, but from what I'm looking around this means keeping the interface untouched which is what I did in my last commit. We can always re-submit that change, if necessary in a followup.

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.
@soltysh
soltysh force-pushed the alternate_lookups branch 2 times, most recently from 0390103 to 3f8f617 Compare May 27, 2021 17:36
@smarterclayton

Copy link
Copy Markdown
Contributor

Can you squash the last commit into the previous one?

@soltysh
soltysh force-pushed the alternate_lookups branch from 3f8f617 to 2d81863 Compare June 2, 2021 07:34
@soltysh

soltysh commented Jun 2, 2021

Copy link
Copy Markdown
Author

Can you squash the last commit into the previous one?

Done

@smarterclayton

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 2, 2021
@openshift-ci

openshift-ci Bot commented Jun 2, 2021

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smarterclayton, soltysh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 2, 2021
@openshift-merge-robot
openshift-merge-robot merged commit 18acde7 into openshift:master Jun 2, 2021
@soltysh
soltysh deleted the alternate_lookups branch June 2, 2021 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants