Look for plugins in a non-conflicting location
When we do plugin discovery, don't look in places that would cause our plugins to be mixed up with docker's or vice-versa. Drop plugin management, since we don't talk to remote anything. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
2783450a92
commit
47d8aeb637
3 changed files with 24 additions and 23 deletions
|
@ -15,8 +15,8 @@ import (
|
|||
var (
|
||||
// ErrNotFound plugin not found
|
||||
ErrNotFound = errors.New("plugin not found")
|
||||
socketsPath = "/run/docker/plugins"
|
||||
specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
|
||||
socketsPath = "/run/oci-storage/plugins"
|
||||
specsPaths = []string{"/etc/oci-storage/plugins", "/usr/lib/oci-storage/plugins"}
|
||||
)
|
||||
|
||||
// localRegistry defines a registry that is local (using unix socket).
|
||||
|
|
|
@ -33,8 +33,8 @@ func TestFileSpecPlugin(t *testing.T) {
|
|||
fail bool
|
||||
}{
|
||||
// TODO Windows: Factor out the unix:// variants.
|
||||
{filepath.Join(tmpdir, "echo.spec"), "echo", "unix://var/lib/docker/plugins/echo.sock", false},
|
||||
{filepath.Join(tmpdir, "echo", "echo.spec"), "echo", "unix://var/lib/docker/plugins/echo.sock", false},
|
||||
{filepath.Join(tmpdir, "echo.spec"), "echo", "unix://var/lib/oci-storage/plugins/echo.sock", false},
|
||||
{filepath.Join(tmpdir, "echo", "echo.spec"), "echo", "unix://var/lib/oci-storage/plugins/echo.sock", false},
|
||||
{filepath.Join(tmpdir, "foo.spec"), "foo", "tcp://localhost:8080", false},
|
||||
{filepath.Join(tmpdir, "foo", "foo.spec"), "foo", "tcp://localhost:8080", false},
|
||||
{filepath.Join(tmpdir, "bar.spec"), "bar", "localhost:8080", true}, // unknown transport
|
||||
|
@ -79,11 +79,11 @@ func TestFileJSONSpecPlugin(t *testing.T) {
|
|||
p := filepath.Join(tmpdir, "example.json")
|
||||
spec := `{
|
||||
"Name": "plugin-example",
|
||||
"Addr": "https://example.com/docker/plugin",
|
||||
"Addr": "https://example.com/oci-storage/plugin",
|
||||
"TLSConfig": {
|
||||
"CAFile": "/usr/shared/docker/certs/example-ca.pem",
|
||||
"CertFile": "/usr/shared/docker/certs/example-cert.pem",
|
||||
"KeyFile": "/usr/shared/docker/certs/example-key.pem"
|
||||
"CAFile": "/usr/shared/oci-storage/certs/example-ca.pem",
|
||||
"CertFile": "/usr/shared/oci-storage/certs/example-cert.pem",
|
||||
"KeyFile": "/usr/shared/oci-storage/certs/example-key.pem"
|
||||
}
|
||||
}`
|
||||
|
||||
|
@ -101,19 +101,19 @@ func TestFileJSONSpecPlugin(t *testing.T) {
|
|||
t.Fatalf("Expected plugin `plugin-example`, got %s\n", plugin.Name)
|
||||
}
|
||||
|
||||
if plugin.Addr != "https://example.com/docker/plugin" {
|
||||
t.Fatalf("Expected plugin addr `https://example.com/docker/plugin`, got %s\n", plugin.Addr)
|
||||
if plugin.Addr != "https://example.com/oci-storage/plugin" {
|
||||
t.Fatalf("Expected plugin addr `https://example.com/oci-storage/plugin`, got %s\n", plugin.Addr)
|
||||
}
|
||||
|
||||
if plugin.TLSConfig.CAFile != "/usr/shared/docker/certs/example-ca.pem" {
|
||||
t.Fatalf("Expected plugin CA `/usr/shared/docker/certs/example-ca.pem`, got %s\n", plugin.TLSConfig.CAFile)
|
||||
if plugin.TLSConfig.CAFile != "/usr/shared/oci-storage/certs/example-ca.pem" {
|
||||
t.Fatalf("Expected plugin CA `/usr/shared/oci-storage/certs/example-ca.pem`, got %s\n", plugin.TLSConfig.CAFile)
|
||||
}
|
||||
|
||||
if plugin.TLSConfig.CertFile != "/usr/shared/docker/certs/example-cert.pem" {
|
||||
t.Fatalf("Expected plugin Certificate `/usr/shared/docker/certs/example-cert.pem`, got %s\n", plugin.TLSConfig.CertFile)
|
||||
if plugin.TLSConfig.CertFile != "/usr/shared/oci-storage/certs/example-cert.pem" {
|
||||
t.Fatalf("Expected plugin Certificate `/usr/shared/oci-storage/certs/example-cert.pem`, got %s\n", plugin.TLSConfig.CertFile)
|
||||
}
|
||||
|
||||
if plugin.TLSConfig.KeyFile != "/usr/shared/docker/certs/example-key.pem" {
|
||||
t.Fatalf("Expected plugin Key `/usr/shared/docker/certs/example-key.pem`, got %s\n", plugin.TLSConfig.KeyFile)
|
||||
if plugin.TLSConfig.KeyFile != "/usr/shared/oci-storage/certs/example-key.pem" {
|
||||
t.Fatalf("Expected plugin Key `/usr/shared/oci-storage/certs/example-key.pem`, got %s\n", plugin.TLSConfig.KeyFile)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
// Package plugins provides structures and helper functions to manage Docker
|
||||
// plugins.
|
||||
//
|
||||
// Docker discovers plugins by looking for them in the plugin directory whenever
|
||||
// Storage discovers plugins by looking for them in the plugin directory whenever
|
||||
// a user or container tries to use one by name. UNIX domain socket files must
|
||||
// be located under /run/docker/plugins, whereas spec files can be located
|
||||
// either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled
|
||||
// by the Registry interface, which lets you list all plugins or get a plugin by
|
||||
// its name if it exists.
|
||||
// be located under /run/oci-storage/plugins, whereas spec files can be located
|
||||
// either under /etc/oci-storage/plugins or /usr/lib/oci-storage/plugins. This
|
||||
// is handled by the Registry interface, which lets you list all plugins or get
|
||||
// a plugin by its name if it exists.
|
||||
//
|
||||
// The plugins need to implement an HTTP server and bind this to the UNIX socket
|
||||
// or the address specified in the spec files.
|
||||
// A handshake is send at /Plugin.Activate, and plugins are expected to return
|
||||
// a Manifest with a list of of Docker subsystems which this plugin implements.
|
||||
// a Manifest with a list of subsystems which this plugin implements. As of
|
||||
// this writing, the known subsystem is "GraphDriver".
|
||||
//
|
||||
// In order to use a plugins, you can use the ``Get`` with the name of the
|
||||
// plugin and the subsystem it implements.
|
||||
|
@ -52,7 +53,7 @@ type Manifest struct {
|
|||
Implements []string
|
||||
}
|
||||
|
||||
// Plugin is the definition of a docker plugin.
|
||||
// Plugin is the definition of a storage plugin.
|
||||
type Plugin struct {
|
||||
// Name of the plugin
|
||||
name string
|
||||
|
|
Loading…
Reference in a new issue