Skip to content

Commit

Permalink
registry: remove deprecated APIEndpoint.Version and APIVersion type
Browse files Browse the repository at this point in the history
This field was unused, and support for v1 registries was removed a long
time ago. It was deprecated in d43e617
(part of v25.0), and marked for deletion after that release.

This removes the deprecated field and types;

- `registry.APIEndpoint.Version` field
- `registry.APIVersion` type
- `registry.APIVersion1` const
- `registry.APIVersion2` const

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Nov 30, 2024
1 parent bff7444 commit 3903f71
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion registry/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func (s *Service) ResolveRepository(name reference.Named) (*RepositoryInfo, erro
type APIEndpoint struct {
Mirror bool
URL *url.URL
Version APIVersion // Deprecated: v1 registries are deprecated, and endpoints are always v2.
AllowNondistributableArtifacts bool
Official bool
TrimHostname bool
Expand Down
4 changes: 0 additions & 4 deletions registry/service_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ func (s *Service) lookupV2Endpoints(hostname string) (endpoints []APIEndpoint, e
}
endpoints = append(endpoints, APIEndpoint{
URL: mirrorURL,
Version: APIVersion2, //nolint:staticcheck // ignore SA1019 (Version is deprecated) to allow potential consumers to transition.
Mirror: true,
TrimHostname: true,
TLSConfig: mirrorTLSConfig,
})
}
endpoints = append(endpoints, APIEndpoint{
URL: DefaultV2Registry,
Version: APIVersion2, //nolint:staticcheck // ignore SA1019 (Version is deprecated) to allow potential consumers to transition.
Official: true,
TrimHostname: true,
TLSConfig: tlsconfig.ServerDefault(),
Expand All @@ -55,7 +53,6 @@ func (s *Service) lookupV2Endpoints(hostname string) (endpoints []APIEndpoint, e
Scheme: "https",
Host: hostname,
},
Version: APIVersion2, //nolint:staticcheck // ignore SA1019 (Version is deprecated) to allow potential consumers to transition.
AllowNondistributableArtifacts: ana,
TrimHostname: true,
TLSConfig: tlsConfig,
Expand All @@ -68,7 +65,6 @@ func (s *Service) lookupV2Endpoints(hostname string) (endpoints []APIEndpoint, e
Scheme: "http",
Host: hostname,
},
Version: APIVersion2, //nolint:staticcheck // ignore SA1019 (Version is deprecated) to allow potential consumers to transition.
AllowNondistributableArtifacts: ana,
TrimHostname: true,
// used to check if supposed to be secure via InsecureSkipVerify
Expand Down
21 changes: 0 additions & 21 deletions registry/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@ import (
"github.com/docker/docker/api/types/registry"
)

// APIVersion is an integral representation of an API version (presently
// either 1 or 2)
//
// Deprecated: v1 registries are deprecated, and endpoints are always v2.
type APIVersion int

func (av APIVersion) String() string {
return apiVersions[av]
}

// API Version identifiers.
const (
APIVersion1 APIVersion = 1 // Deprecated: v1 registries are deprecated, and endpoints are always v2.
APIVersion2 APIVersion = 2 // Deprecated: v1 registries are deprecated, and endpoints are always v2.
)

var apiVersions = map[APIVersion]string{
APIVersion1: "v1",
APIVersion2: "v2",
}

// RepositoryInfo describes a repository
type RepositoryInfo struct {
Name reference.Named
Expand Down

0 comments on commit 3903f71

Please sign in to comment.