plugin: add EndpointResolver interface

This defines the interface that the package expects in order to lookup
pull endpoints, instead of requiring the whole registry.Service interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-11 15:29:23 +01:00
parent 61599d0a4d
commit f9f549cbe4
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 9 additions and 7 deletions

View file

@ -40,6 +40,11 @@ type Executor interface {
Signal(id string, signal int) error
}
// EndpointResolver provides looking up registry endpoints for pulling.
type EndpointResolver interface {
LookupPullEndpoints(hostname string) (endpoints []registry.APIEndpoint, err error)
}
func (pm *Manager) restorePlugin(p *v2.Plugin, c *controller) error {
if p.IsEnabled() {
return pm.restore(p, c)
@ -52,7 +57,7 @@ type eventLogger func(id, name, action string)
// ManagerConfig defines configuration needed to start new manager.
type ManagerConfig struct {
Store *Store // remove
RegistryService registry.Service
RegistryService EndpointResolver
LiveRestoreEnabled bool // TODO: remove
LogPluginEvent eventLogger
Root string

View file

@ -7,16 +7,13 @@ import (
"net/http"
"time"
"github.com/sirupsen/logrus"
"github.com/docker/docker/dockerversion"
"github.com/pkg/errors"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/dockerversion"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
// scope builds the correct auth scope for the registry client to authorize against