registry/client: remove uses of APIEndpoint.TrimHostName

This field was added in 19515a7ad8,
but looks to be always set for endpoints used, so we can trim remote names
unconditionally.

This option was added for possible future expansion, allowing registry-
mirrors to get the full reference of the image (including domain-name),
for them to host a mirror for multiple upstreams on the same registry.

That approach will unlikely be implemented, and containerd has a different
approach for this, where the reference to the original registry is passed
through a query parameter instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-12-06 23:06:01 +01:00
parent e554bfef6c
commit afab765014
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -22,12 +22,7 @@ type repositoryEndpoint struct {
// Name returns the repository name
func (r repositoryEndpoint) Name() string {
repoName := r.info.Name.Name()
// If endpoint does not support CanonicalName, use the RemoteName instead
if r.endpoint.TrimHostname {
repoName = reference.Path(r.info.Name)
}
return repoName
return reference.Path(r.info.Name)
}
// BaseURL returns the endpoint url