diff options
Diffstat (limited to 'registry/service.go')
-rw-r--r-- | registry/service.go | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/registry/service.go b/registry/service.go index 4b38349de6..25b116a279 100644 --- a/registry/service.go +++ b/registry/service.go @@ -24,7 +24,6 @@ type Service interface { ResolveRepository(name reference.Named) (*RepositoryInfo, error) Search(ctx context.Context, term string, limit int, authConfig *types.AuthConfig, userAgent string, headers map[string][]string) (*registry.SearchResults, error) ServiceConfig() *registry.ServiceConfig - TLSConfig(hostname string) (*tls.Config, error) LoadAllowNondistributableArtifacts([]string) error LoadMirrors([]string) error LoadInsecureRegistries([]string) error @@ -171,23 +170,16 @@ func (s *defaultService) Search(ctx context.Context, term string, limit int, aut modifiers := Headers(userAgent, nil) v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes) if err != nil { - if fErr, ok := err.(fallbackError); ok { - logrus.WithError(fErr.err).Error("cannot use identity token for search, v2 auth not supported") - } else { - return nil, err - } - } else { - // Copy non transport http client features - v2Client.Timeout = endpoint.client.Timeout - v2Client.CheckRedirect = endpoint.client.CheckRedirect - v2Client.Jar = endpoint.client.Jar - - logrus.Debugf("using v2 client for search to %s", endpoint.URL) - client = v2Client + return nil, err } - } - - if client == nil { + // Copy non transport http client features + v2Client.Timeout = endpoint.client.Timeout + v2Client.CheckRedirect = endpoint.client.CheckRedirect + v2Client.Jar = endpoint.client.Jar + + logrus.Debugf("using v2 client for search to %s", endpoint.URL) + client = v2Client + } else { client = endpoint.client if err := authorizeClient(client, authConfig, endpoint); err != nil { return nil, err @@ -216,15 +208,6 @@ type APIEndpoint struct { TLSConfig *tls.Config } -// TLSConfig constructs a client TLS configuration based on server defaults -func (s *defaultService) TLSConfig(hostname string) (*tls.Config, error) { - s.mu.RLock() - secure := s.config.isSecureIndex(hostname) - s.mu.RUnlock() - - return newTLSConfig(hostname, secure) -} - // LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference. // It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP. func (s *defaultService) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) { |