From bfadae77e062003dc59ed7f614f227318e023351 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Wed, 18 Mar 2015 22:18:31 -0700 Subject: [PATCH] Promote volume plugins, prep for persistent vols Move pkg/kubelet/volume/... to pkg/volume/... Some renames to make the soon-to-come persistent volumes work clearer. --- cmd/integration/integration.go | 2 +- cmd/kubelet/app/plugins.go | 20 ++++----- cmd/kubelet/app/server.go | 6 +-- pkg/kubelet/kubelet.go | 8 ++-- pkg/kubelet/kubelet_test.go | 10 ++--- pkg/kubelet/volumes.go | 2 +- pkg/{kubelet => }/volume/doc.go | 0 .../volume/empty_dir/empty_dir.go | 14 +++---- .../volume/empty_dir/empty_dir_linux.go | 0 .../volume/empty_dir/empty_dir_test.go | 8 ++-- .../volume/empty_dir/empty_dir_unsupported.go | 0 pkg/{kubelet => }/volume/gce_pd/gce_pd.go | 14 +++---- .../volume/gce_pd/gce_pd_test.go | 14 +++---- pkg/{kubelet => }/volume/gce_pd/gce_util.go | 0 .../volume/gce_pd/gce_util_test.go | 0 pkg/{kubelet => }/volume/git_repo/git_repo.go | 12 +++--- .../volume/git_repo/git_repo_test.go | 16 +++---- .../volume/host_path/host_path.go | 12 +++--- .../volume/host_path/host_path_test.go | 10 ++--- pkg/{kubelet => }/volume/nfs/nfs.go | 12 +++--- pkg/{kubelet => }/volume/nfs/nfs_mount.go | 0 pkg/{kubelet => }/volume/nfs/nfs_test.go | 10 ++--- pkg/{kubelet => }/volume/plugins.go | 27 ++++++------ pkg/{kubelet => }/volume/secret/secret.go | 10 ++--- .../volume/secret/secret_test.go | 12 +++--- pkg/{kubelet => }/volume/testing.go | 42 +++++++++---------- pkg/{kubelet => }/volume/volume.go | 8 ++-- 27 files changed, 135 insertions(+), 134 deletions(-) rename pkg/{kubelet => }/volume/doc.go (100%) rename pkg/{kubelet => }/volume/empty_dir/empty_dir.go (95%) rename pkg/{kubelet => }/volume/empty_dir/empty_dir_linux.go (100%) rename pkg/{kubelet => }/volume/empty_dir/empty_dir_test.go (96%) rename pkg/{kubelet => }/volume/empty_dir/empty_dir_unsupported.go (100%) rename pkg/{kubelet => }/volume/gce_pd/gce_pd.go (95%) rename pkg/{kubelet => }/volume/gce_pd/gce_pd_test.go (90%) rename pkg/{kubelet => }/volume/gce_pd/gce_util.go (100%) rename pkg/{kubelet => }/volume/gce_pd/gce_util_test.go (100%) rename pkg/{kubelet => }/volume/git_repo/git_repo.go (94%) rename pkg/{kubelet => }/volume/git_repo/git_repo_test.go (92%) rename pkg/{kubelet => }/volume/host_path/host_path.go (88%) rename pkg/{kubelet => }/volume/host_path/host_path_test.go (87%) rename pkg/{kubelet => }/volume/nfs/nfs.go (94%) rename pkg/{kubelet => }/volume/nfs/nfs_mount.go (100%) rename pkg/{kubelet => }/volume/nfs/nfs_test.go (93%) rename pkg/{kubelet => }/volume/plugins.go (88%) rename pkg/{kubelet => }/volume/secret/secret.go (94%) rename pkg/{kubelet => }/volume/secret/secret_test.go (91%) rename pkg/{kubelet => }/volume/testing.go (62%) rename pkg/{kubelet => }/volume/volume.go (94%) diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index c79869c642714..ab8b5902bd470 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -44,13 +44,13 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/cadvisor" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/empty_dir" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/master" "github.com/GoogleCloudPlatform/kubernetes/pkg/probe" "github.com/GoogleCloudPlatform/kubernetes/pkg/service" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/empty_dir" "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/admission/admit" "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler" _ "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithmprovider" diff --git a/cmd/kubelet/app/plugins.go b/cmd/kubelet/app/plugins.go index b61ac170038b7..73675255e024f 100644 --- a/cmd/kubelet/app/plugins.go +++ b/cmd/kubelet/app/plugins.go @@ -24,18 +24,18 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network/exec" // Volume plugins - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/empty_dir" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/gce_pd" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/git_repo" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/host_path" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/nfs" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/secret" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/empty_dir" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/gce_pd" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/git_repo" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/host_path" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/nfs" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/secret" ) // ProbeVolumePlugins collects all volume plugins into an easy to use list. -func ProbeVolumePlugins() []volume.Plugin { - allPlugins := []volume.Plugin{} +func ProbeVolumePlugins() []volume.VolumePlugin { + allPlugins := []volume.VolumePlugin{} // The list of plugins to probe is decided by the kubelet binary, not // by dynamic linking or other "magic". Plugins will be analyzed and @@ -44,8 +44,8 @@ func ProbeVolumePlugins() []volume.Plugin { allPlugins = append(allPlugins, gce_pd.ProbeVolumePlugins()...) allPlugins = append(allPlugins, git_repo.ProbeVolumePlugins()...) allPlugins = append(allPlugins, host_path.ProbeVolumePlugins()...) - allPlugins = append(allPlugins, secret.ProbeVolumePlugins()...) allPlugins = append(allPlugins, nfs.ProbeVolumePlugins()...) + allPlugins = append(allPlugins, secret.ProbeVolumePlugins()...) return allPlugins } diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index 73da9984b8105..231b3f809055f 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -34,9 +34,9 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/golang/glog" "github.com/spf13/pflag" @@ -267,7 +267,7 @@ func SimpleRunKubelet(client *client.Client, hostname, rootDir, manifestURL, address string, port uint, masterServiceNamespace string, - volumePlugins []volume.Plugin, + volumePlugins []volume.VolumePlugin, tlsOptions *kubelet.TLSOptions, cadvisorInterface cadvisor.Interface, configFilePath string) { @@ -402,7 +402,7 @@ type KubeletConfig struct { Port uint Runonce bool MasterServiceNamespace string - VolumePlugins []volume.Plugin + VolumePlugins []volume.VolumePlugin NetworkPlugins []network.NetworkPlugin NetworkPluginName string StreamingConnectionIdleTimeout time.Duration diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 1bb9c03c24741..80a15e3ed80f9 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -43,7 +43,6 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/envvars" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/metrics" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/probe" "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" @@ -51,6 +50,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" utilErrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/watch" "github.com/fsouza/go-dockerclient" "github.com/golang/glog" @@ -101,7 +101,7 @@ type SyncHandler interface { type SourcesReadyFn func() bool -type volumeMap map[string]volume.Interface +type volumeMap map[string]volume.Volume // New creates a new Kubelet for use in main func NewMainKubelet( @@ -118,7 +118,7 @@ func NewMainKubelet( clusterDomain string, clusterDNS net.IP, masterServiceNamespace string, - volumePlugins []volume.Plugin, + volumePlugins []volume.VolumePlugin, networkPlugins []network.NetworkPlugin, networkPluginName string, streamingConnectionIdleTimeout time.Duration, @@ -308,7 +308,7 @@ type Kubelet struct { serviceLister serviceLister // Volume plugins. - volumePluginMgr volume.PluginMgr + volumePluginMgr volume.VolumePluginMgr // Network plugin networkPlugin network.NetworkPlugin diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 6698883eb9c32..fc799f6880481 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -40,10 +40,10 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/metrics" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" - _ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/host_path" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" + _ "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/host_path" "github.com/fsouza/go-dockerclient" cadvisorApi "github.com/google/cadvisor/info/v1" ) @@ -1022,7 +1022,7 @@ func TestSyncPodUnhealthy(t *testing.T) { func TestMountExternalVolumes(t *testing.T) { testKubelet := newTestKubelet(t) kubelet := testKubelet.kubelet - kubelet.volumePluginMgr.InitPlugins([]volume.Plugin{&volume.FakePlugin{"fake", nil}}, &volumeHost{kubelet}) + kubelet.volumePluginMgr.InitPlugins([]volume.VolumePlugin{&volume.FakeVolumePlugin{"fake", nil}}, &volumeHost{kubelet}) pod := api.Pod{ ObjectMeta: api.ObjectMeta{ @@ -1057,8 +1057,8 @@ func TestMountExternalVolumes(t *testing.T) { func TestGetPodVolumesFromDisk(t *testing.T) { testKubelet := newTestKubelet(t) kubelet := testKubelet.kubelet - plug := &volume.FakePlugin{"fake", nil} - kubelet.volumePluginMgr.InitPlugins([]volume.Plugin{plug}, &volumeHost{kubelet}) + plug := &volume.FakeVolumePlugin{"fake", nil} + kubelet.volumePluginMgr.InitPlugins([]volume.VolumePlugin{plug}, &volumeHost{kubelet}) volsOnDisk := []struct { podUID types.UID diff --git a/pkg/kubelet/volumes.go b/pkg/kubelet/volumes.go index 5fda3388c5029..a8ee4107a2808 100644 --- a/pkg/kubelet/volumes.go +++ b/pkg/kubelet/volumes.go @@ -23,8 +23,8 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/davecgh/go-spew/spew" "github.com/golang/glog" ) diff --git a/pkg/kubelet/volume/doc.go b/pkg/volume/doc.go similarity index 100% rename from pkg/kubelet/volume/doc.go rename to pkg/volume/doc.go diff --git a/pkg/kubelet/volume/empty_dir/empty_dir.go b/pkg/volume/empty_dir/empty_dir.go similarity index 95% rename from pkg/kubelet/volume/empty_dir/empty_dir.go rename to pkg/volume/empty_dir/empty_dir.go index 67fb03db41fd0..4517e45c4608b 100644 --- a/pkg/kubelet/volume/empty_dir/empty_dir.go +++ b/pkg/volume/empty_dir/empty_dir.go @@ -21,40 +21,40 @@ import ( "os" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) // This is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.Plugin { +func ProbeVolumePlugins() []volume.VolumePlugin { return ProbeVolumePluginsWithMounter(mount.New()) } // ProbePluginsWithMounter is a convenience for testing other plugins which wrap this one. //FIXME: alternative: pass mount.Interface to all ProbeVolumePlugins() functions? Opinions? -func ProbeVolumePluginsWithMounter(mounter mount.Interface) []volume.Plugin { - return []volume.Plugin{ +func ProbeVolumePluginsWithMounter(mounter mount.Interface) []volume.VolumePlugin { + return []volume.VolumePlugin{ &emptyDirPlugin{nil, mounter, false}, &emptyDirPlugin{nil, mounter, true}, } } type emptyDirPlugin struct { - host volume.Host + host volume.VolumeHost mounter mount.Interface legacyMode bool // if set, plugin answers to the legacy name } -var _ volume.Plugin = &emptyDirPlugin{} +var _ volume.VolumePlugin = &emptyDirPlugin{} const ( emptyDirPluginName = "kubernetes.io/empty-dir" emptyDirPluginLegacyName = "empty" ) -func (plugin *emptyDirPlugin) Init(host volume.Host) { +func (plugin *emptyDirPlugin) Init(host volume.VolumeHost) { plugin.host = host } diff --git a/pkg/kubelet/volume/empty_dir/empty_dir_linux.go b/pkg/volume/empty_dir/empty_dir_linux.go similarity index 100% rename from pkg/kubelet/volume/empty_dir/empty_dir_linux.go rename to pkg/volume/empty_dir/empty_dir_linux.go diff --git a/pkg/kubelet/volume/empty_dir/empty_dir_test.go b/pkg/volume/empty_dir/empty_dir_test.go similarity index 96% rename from pkg/kubelet/volume/empty_dir/empty_dir_test.go rename to pkg/volume/empty_dir/empty_dir_test.go index 8be26098d643c..08df4f979611b 100644 --- a/pkg/kubelet/volume/empty_dir/empty_dir_test.go +++ b/pkg/volume/empty_dir/empty_dir_test.go @@ -22,18 +22,18 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) // The dir where volumes will be stored. const basePath = "/tmp/fake" // Construct an instance of a plugin, by name. -func makePluginUnderTest(t *testing.T, plugName string) volume.Plugin { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost(basePath, nil, nil)) +func makePluginUnderTest(t *testing.T, plugName string) volume.VolumePlugin { + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost(basePath, nil, nil)) plug, err := plugMgr.FindPluginByName(plugName) if err != nil { diff --git a/pkg/kubelet/volume/empty_dir/empty_dir_unsupported.go b/pkg/volume/empty_dir/empty_dir_unsupported.go similarity index 100% rename from pkg/kubelet/volume/empty_dir/empty_dir_unsupported.go rename to pkg/volume/empty_dir/empty_dir_unsupported.go diff --git a/pkg/kubelet/volume/gce_pd/gce_pd.go b/pkg/volume/gce_pd/gce_pd.go similarity index 95% rename from pkg/kubelet/volume/gce_pd/gce_pd.go rename to pkg/volume/gce_pd/gce_pd.go index 54bb1cbf72ec9..66c7b28b5a2ff 100644 --- a/pkg/kubelet/volume/gce_pd/gce_pd.go +++ b/pkg/volume/gce_pd/gce_pd.go @@ -23,31 +23,31 @@ import ( "strconv" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/golang/glog" ) // This is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.Plugin { - return []volume.Plugin{&gcePersistentDiskPlugin{nil, false}, &gcePersistentDiskPlugin{nil, true}} +func ProbeVolumePlugins() []volume.VolumePlugin { + return []volume.VolumePlugin{&gcePersistentDiskPlugin{nil, false}, &gcePersistentDiskPlugin{nil, true}} } type gcePersistentDiskPlugin struct { - host volume.Host + host volume.VolumeHost legacyMode bool // if set, plugin answers to the legacy name } -var _ volume.Plugin = &gcePersistentDiskPlugin{} +var _ volume.VolumePlugin = &gcePersistentDiskPlugin{} const ( gcePersistentDiskPluginName = "kubernetes.io/gce-pd" gcePersistentDiskPluginLegacyName = "gce-pd" ) -func (plugin *gcePersistentDiskPlugin) Init(host volume.Host) { +func (plugin *gcePersistentDiskPlugin) Init(host volume.VolumeHost) { plugin.host = host } @@ -233,7 +233,7 @@ func (pd *gcePersistentDisk) SetUpAt(dir string) error { return nil } -func makeGlobalPDName(host volume.Host, devName string) string { +func makeGlobalPDName(host volume.VolumeHost, devName string) string { return path.Join(host.GetPluginDir(gcePersistentDiskPluginName), "mounts", devName) } diff --git a/pkg/kubelet/volume/gce_pd/gce_pd_test.go b/pkg/volume/gce_pd/gce_pd_test.go similarity index 90% rename from pkg/kubelet/volume/gce_pd/gce_pd_test.go rename to pkg/volume/gce_pd/gce_pd_test.go index 3c902413c7a44..0e7920a4eb5c1 100644 --- a/pkg/kubelet/volume/gce_pd/gce_pd_test.go +++ b/pkg/volume/gce_pd/gce_pd_test.go @@ -21,14 +21,14 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) func TestCanSupport(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("/tmp/fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd") if err != nil { @@ -65,8 +65,8 @@ func (fake *fakePDManager) DetachDisk(pd *gcePersistentDisk) error { } func TestPlugin(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("/tmp/fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd") if err != nil { @@ -131,8 +131,8 @@ func TestPlugin(t *testing.T) { } func TestPluginLegacy(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("/tmp/fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plug, err := plugMgr.FindPluginByName("gce-pd") if err != nil { diff --git a/pkg/kubelet/volume/gce_pd/gce_util.go b/pkg/volume/gce_pd/gce_util.go similarity index 100% rename from pkg/kubelet/volume/gce_pd/gce_util.go rename to pkg/volume/gce_pd/gce_util.go diff --git a/pkg/kubelet/volume/gce_pd/gce_util_test.go b/pkg/volume/gce_pd/gce_util_test.go similarity index 100% rename from pkg/kubelet/volume/gce_pd/gce_util_test.go rename to pkg/volume/gce_pd/gce_util_test.go diff --git a/pkg/kubelet/volume/git_repo/git_repo.go b/pkg/volume/git_repo/git_repo.go similarity index 94% rename from pkg/kubelet/volume/git_repo/git_repo.go rename to pkg/volume/git_repo/git_repo.go index 5842fdeda384e..995edc0eedc2b 100644 --- a/pkg/kubelet/volume/git_repo/git_repo.go +++ b/pkg/volume/git_repo/git_repo.go @@ -23,30 +23,30 @@ import ( "path" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/golang/glog" ) // This is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.Plugin { - return []volume.Plugin{&gitRepoPlugin{nil, false}, &gitRepoPlugin{nil, true}} +func ProbeVolumePlugins() []volume.VolumePlugin { + return []volume.VolumePlugin{&gitRepoPlugin{nil, false}, &gitRepoPlugin{nil, true}} } type gitRepoPlugin struct { - host volume.Host + host volume.VolumeHost legacyMode bool // if set, plugin answers to the legacy name } -var _ volume.Plugin = &gitRepoPlugin{} +var _ volume.VolumePlugin = &gitRepoPlugin{} const ( gitRepoPluginName = "kubernetes.io/git-repo" gitRepoPluginLegacyName = "git" ) -func (plugin *gitRepoPlugin) Init(host volume.Host) { +func (plugin *gitRepoPlugin) Init(host volume.VolumeHost) { plugin.host = host } diff --git a/pkg/kubelet/volume/git_repo/git_repo_test.go b/pkg/volume/git_repo/git_repo_test.go similarity index 92% rename from pkg/kubelet/volume/git_repo/git_repo_test.go rename to pkg/volume/git_repo/git_repo_test.go index 6e309697724d9..55281d9181eae 100644 --- a/pkg/kubelet/volume/git_repo/git_repo_test.go +++ b/pkg/volume/git_repo/git_repo_test.go @@ -25,22 +25,22 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/empty_dir" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/exec" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/empty_dir" ) -func newTestHost(t *testing.T) volume.Host { +func newTestHost(t *testing.T) volume.VolumeHost { tempDir, err := ioutil.TempDir("/tmp", "git_repo_test.") if err != nil { t.Fatalf("can't make a temp rootdir: %v", err) } - return volume.NewFakeHost(tempDir, nil, empty_dir.ProbeVolumePlugins()) + return volume.NewFakeVolumeHost(tempDir, nil, empty_dir.ProbeVolumePlugins()) } func TestCanSupport(t *testing.T) { - plugMgr := volume.PluginMgr{} + plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(), newTestHost(t)) plug, err := plugMgr.FindPluginByName("kubernetes.io/git-repo") @@ -55,7 +55,7 @@ func TestCanSupport(t *testing.T) { } } -func testSetUp(plug volume.Plugin, builder volume.Builder, t *testing.T) { +func testSetUp(plug volume.VolumePlugin, builder volume.Builder, t *testing.T) { var fcmd exec.FakeCmd fcmd = exec.FakeCmd{ CombinedOutputScript: []exec.FakeCombinedOutputAction{ @@ -102,7 +102,7 @@ func testSetUp(plug volume.Plugin, builder volume.Builder, t *testing.T) { } func TestPlugin(t *testing.T) { - plugMgr := volume.PluginMgr{} + plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(), newTestHost(t)) plug, err := plugMgr.FindPluginByName("kubernetes.io/git-repo") @@ -159,7 +159,7 @@ func TestPlugin(t *testing.T) { } func TestPluginLegacy(t *testing.T) { - plugMgr := volume.PluginMgr{} + plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(), newTestHost(t)) plug, err := plugMgr.FindPluginByName("git") diff --git a/pkg/kubelet/volume/host_path/host_path.go b/pkg/volume/host_path/host_path.go similarity index 88% rename from pkg/kubelet/volume/host_path/host_path.go rename to pkg/volume/host_path/host_path.go index 3f397ea531881..54916603c9180 100644 --- a/pkg/kubelet/volume/host_path/host_path.go +++ b/pkg/volume/host_path/host_path.go @@ -20,26 +20,26 @@ import ( "fmt" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) // This is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.Plugin { - return []volume.Plugin{&hostPathPlugin{nil}} +func ProbeVolumePlugins() []volume.VolumePlugin { + return []volume.VolumePlugin{&hostPathPlugin{nil}} } type hostPathPlugin struct { - host volume.Host + host volume.VolumeHost } -var _ volume.Plugin = &hostPathPlugin{} +var _ volume.VolumePlugin = &hostPathPlugin{} const ( hostPathPluginName = "kubernetes.io/host-path" ) -func (plugin *hostPathPlugin) Init(host volume.Host) { +func (plugin *hostPathPlugin) Init(host volume.VolumeHost) { plugin.host = host } diff --git a/pkg/kubelet/volume/host_path/host_path_test.go b/pkg/volume/host_path/host_path_test.go similarity index 87% rename from pkg/kubelet/volume/host_path/host_path_test.go rename to pkg/volume/host_path/host_path_test.go index b7cf0cb6c2cdc..54d50c0436ef3 100644 --- a/pkg/kubelet/volume/host_path/host_path_test.go +++ b/pkg/volume/host_path/host_path_test.go @@ -20,13 +20,13 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) func TestCanSupport(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path") if err != nil { @@ -44,8 +44,8 @@ func TestCanSupport(t *testing.T) { } func TestPlugin(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path") if err != nil { diff --git a/pkg/kubelet/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go similarity index 94% rename from pkg/kubelet/volume/nfs/nfs.go rename to pkg/volume/nfs/nfs.go index b77ef7c2ab9ba..5d0e720566330 100644 --- a/pkg/kubelet/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -20,28 +20,28 @@ import ( "os" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/golang/glog" ) // This is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.Plugin { - return []volume.Plugin{&nfsPlugin{nil, newNFSMounter()}} +func ProbeVolumePlugins() []volume.VolumePlugin { + return []volume.VolumePlugin{&nfsPlugin{nil, newNFSMounter()}} } type nfsPlugin struct { - host volume.Host + host volume.VolumeHost mounter nfsMountInterface } -var _ volume.Plugin = &nfsPlugin{} +var _ volume.VolumePlugin = &nfsPlugin{} const ( nfsPluginName = "kubernetes.io/nfs" ) -func (plugin *nfsPlugin) Init(host volume.Host) { +func (plugin *nfsPlugin) Init(host volume.VolumeHost) { plugin.host = host } diff --git a/pkg/kubelet/volume/nfs/nfs_mount.go b/pkg/volume/nfs/nfs_mount.go similarity index 100% rename from pkg/kubelet/volume/nfs/nfs_mount.go rename to pkg/volume/nfs/nfs_mount.go diff --git a/pkg/kubelet/volume/nfs/nfs_test.go b/pkg/volume/nfs/nfs_test.go similarity index 93% rename from pkg/kubelet/volume/nfs/nfs_test.go rename to pkg/volume/nfs/nfs_test.go index ed5765a4c863b..ac14123c2e922 100644 --- a/pkg/kubelet/volume/nfs/nfs_test.go +++ b/pkg/volume/nfs/nfs_test.go @@ -22,14 +22,14 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" ) func TestCanSupport(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs") if err != nil { t.Errorf("Can't find the plugin by name") @@ -75,8 +75,8 @@ func (fake *fakeNFSMounter) IsMountPoint(dir string) (bool, error) { } func TestPlugin(t *testing.T) { - plugMgr := volume.PluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeHost("/tmp/fake", nil, nil)) + plugMgr := volume.VolumePluginMgr{} + plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs") if err != nil { t.Errorf("Can't find the plugin by name") diff --git a/pkg/kubelet/volume/plugins.go b/pkg/volume/plugins.go similarity index 88% rename from pkg/kubelet/volume/plugins.go rename to pkg/volume/plugins.go index 4614360771f2d..ecedd4ec6d485 100644 --- a/pkg/kubelet/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -29,19 +29,20 @@ import ( "github.com/golang/glog" ) -// Plugin is an interface to volume plugins. -type Plugin interface { +// VolumePlugin is an interface to volume plugins that can be used on a +// kubernetes node (e.g. by kubelet) to instantiate and manage volumes. +type VolumePlugin interface { // Init initializes the plugin. This will be called exactly once // before any New* calls are made - implementations of plugins may // depend on this. - Init(host Host) + Init(host VolumeHost) // Name returns the plugin's name. Plugins should use namespaced names // such as "example.com/volume". The "kubernetes.io" namespace is // reserved for plugins which are bundled with kubernetes. Name() string - // CanSupport tests whether the Plugin supports a given volume + // CanSupport tests whether the plugin supports a given volume // specification from the API. The spec pointer should be considered // const. CanSupport(spec *api.Volume) bool @@ -58,8 +59,8 @@ type Plugin interface { NewCleaner(name string, podUID types.UID) (Cleaner, error) } -// Host is an interface that plugins can use to access the kubelet. -type Host interface { +// VolumeHost is an interface that plugins can use to access the kubelet. +type VolumeHost interface { // GetPluginDir returns the absolute path to a directory under which // a given plugin may store data. This directory might not actually // exist on disk yet. For plugin data that is per-pod, see @@ -93,21 +94,21 @@ type Host interface { NewWrapperCleaner(spec *api.Volume, podUID types.UID) (Cleaner, error) } -// PluginMgr tracks registered plugins. -type PluginMgr struct { +// VolumePluginMgr tracks registered plugins. +type VolumePluginMgr struct { mutex sync.Mutex - plugins map[string]Plugin + plugins map[string]VolumePlugin } // InitPlugins initializes each plugin. All plugins must have unique names. // This must be called exactly once before any New* methods are called on any // plugins. -func (pm *PluginMgr) InitPlugins(plugins []Plugin, host Host) error { +func (pm *VolumePluginMgr) InitPlugins(plugins []VolumePlugin, host VolumeHost) error { pm.mutex.Lock() defer pm.mutex.Unlock() if pm.plugins == nil { - pm.plugins = map[string]Plugin{} + pm.plugins = map[string]VolumePlugin{} } allErrs := []error{} @@ -132,7 +133,7 @@ func (pm *PluginMgr) InitPlugins(plugins []Plugin, host Host) error { // FindPluginBySpec looks for a plugin that can support a given volume // specification. If no plugins can support or more than one plugin can // support it, return error. -func (pm *PluginMgr) FindPluginBySpec(spec *api.Volume) (Plugin, error) { +func (pm *VolumePluginMgr) FindPluginBySpec(spec *api.Volume) (VolumePlugin, error) { pm.mutex.Lock() defer pm.mutex.Unlock() @@ -153,7 +154,7 @@ func (pm *PluginMgr) FindPluginBySpec(spec *api.Volume) (Plugin, error) { // FindPluginByName fetches a plugin by name or by legacy name. If no plugin // is found, returns error. -func (pm *PluginMgr) FindPluginByName(name string) (Plugin, error) { +func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error) { pm.mutex.Lock() defer pm.mutex.Unlock() diff --git a/pkg/kubelet/volume/secret/secret.go b/pkg/volume/secret/secret.go similarity index 94% rename from pkg/kubelet/volume/secret/secret.go rename to pkg/volume/secret/secret.go index 6f2ac2bb1b249..2d176605264d3 100644 --- a/pkg/kubelet/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -22,14 +22,14 @@ import ( "path" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" "github.com/golang/glog" ) // ProbeVolumePlugin is the entry point for plugin detection in a package. -func ProbeVolumePlugins() []volume.Plugin { - return []volume.Plugin{&secretPlugin{}} +func ProbeVolumePlugins() []volume.VolumePlugin { + return []volume.VolumePlugin{&secretPlugin{}} } const ( @@ -38,10 +38,10 @@ const ( // secretPlugin implements the VolumePlugin interface. type secretPlugin struct { - host volume.Host + host volume.VolumeHost } -func (plugin *secretPlugin) Init(host volume.Host) { +func (plugin *secretPlugin) Init(host volume.VolumeHost) { plugin.host = host } diff --git a/pkg/kubelet/volume/secret/secret_test.go b/pkg/volume/secret/secret_test.go similarity index 91% rename from pkg/kubelet/volume/secret/secret_test.go rename to pkg/volume/secret/secret_test.go index 01b36cbaf01bb..e839376e3fae4 100644 --- a/pkg/kubelet/volume/secret/secret_test.go +++ b/pkg/volume/secret/secret_test.go @@ -26,23 +26,23 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume" - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/volume/empty_dir" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/mount" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume" + "github.com/GoogleCloudPlatform/kubernetes/pkg/volume/empty_dir" ) -func newTestHost(t *testing.T, client client.Interface) volume.Host { +func newTestHost(t *testing.T, client client.Interface) volume.VolumeHost { tempDir, err := ioutil.TempDir("/tmp", "secret_volume_test.") if err != nil { t.Fatalf("can't make a temp rootdir: %v", err) } - return volume.NewFakeHost(tempDir, client, empty_dir.ProbeVolumePluginsWithMounter(&mount.FakeMounter{})) + return volume.NewFakeVolumeHost(tempDir, client, empty_dir.ProbeVolumePluginsWithMounter(&mount.FakeMounter{})) } func TestCanSupport(t *testing.T) { - pluginMgr := volume.PluginMgr{} + pluginMgr := volume.VolumePluginMgr{} pluginMgr.InitPlugins(ProbeVolumePlugins(), newTestHost(t, nil)) plugin, err := pluginMgr.FindPluginByName(secretPluginName) @@ -93,7 +93,7 @@ func TestPlugin(t *testing.T) { Secret: secret, } - pluginMgr := volume.PluginMgr{} + pluginMgr := volume.VolumePluginMgr{} pluginMgr.InitPlugins(ProbeVolumePlugins(), newTestHost(t, client)) plugin, err := pluginMgr.FindPluginByName(secretPluginName) diff --git a/pkg/kubelet/volume/testing.go b/pkg/volume/testing.go similarity index 62% rename from pkg/kubelet/volume/testing.go rename to pkg/volume/testing.go index baa17cdbf0e0c..6a800f2a784cb 100644 --- a/pkg/kubelet/volume/testing.go +++ b/pkg/volume/testing.go @@ -25,36 +25,36 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/types" ) -// fakeHost is useful for testing volume plugins. -type fakeHost struct { +// fakeVolumeHost is useful for testing volume plugins. +type fakeVolumeHost struct { rootDir string kubeClient client.Interface - pluginMgr PluginMgr + pluginMgr VolumePluginMgr } -func NewFakeHost(rootDir string, kubeClient client.Interface, plugins []Plugin) *fakeHost { - host := &fakeHost{rootDir: rootDir, kubeClient: kubeClient} +func NewFakeVolumeHost(rootDir string, kubeClient client.Interface, plugins []VolumePlugin) *fakeVolumeHost { + host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient} host.pluginMgr.InitPlugins(plugins, host) return host } -func (f *fakeHost) GetPluginDir(podUID string) string { +func (f *fakeVolumeHost) GetPluginDir(podUID string) string { return path.Join(f.rootDir, "plugins", podUID) } -func (f *fakeHost) GetPodVolumeDir(podUID types.UID, pluginName, volumeName string) string { +func (f *fakeVolumeHost) GetPodVolumeDir(podUID types.UID, pluginName, volumeName string) string { return path.Join(f.rootDir, "pods", string(podUID), "volumes", pluginName, volumeName) } -func (f *fakeHost) GetPodPluginDir(podUID types.UID, pluginName string) string { +func (f *fakeVolumeHost) GetPodPluginDir(podUID types.UID, pluginName string) string { return path.Join(f.rootDir, "pods", string(podUID), "plugins", pluginName) } -func (f *fakeHost) GetKubeClient() client.Interface { +func (f *fakeVolumeHost) GetKubeClient() client.Interface { return f.kubeClient } -func (f *fakeHost) NewWrapperBuilder(spec *api.Volume, podRef *api.ObjectReference) (Builder, error) { +func (f *fakeVolumeHost) NewWrapperBuilder(spec *api.Volume, podRef *api.ObjectReference) (Builder, error) { plug, err := f.pluginMgr.FindPluginBySpec(spec) if err != nil { return nil, err @@ -62,7 +62,7 @@ func (f *fakeHost) NewWrapperBuilder(spec *api.Volume, podRef *api.ObjectReferen return plug.NewBuilder(spec, podRef) } -func (f *fakeHost) NewWrapperCleaner(spec *api.Volume, podUID types.UID) (Cleaner, error) { +func (f *fakeVolumeHost) NewWrapperCleaner(spec *api.Volume, podUID types.UID) (Cleaner, error) { plug, err := f.pluginMgr.FindPluginBySpec(spec) if err != nil { return nil, err @@ -70,42 +70,42 @@ func (f *fakeHost) NewWrapperCleaner(spec *api.Volume, podUID types.UID) (Cleane return plug.NewCleaner(spec.Name, podUID) } -// FakePlugin is useful for for testing. It tries to be a fully compliant +// FakeVolumePlugin is useful for for testing. It tries to be a fully compliant // plugin, but all it does is make empty directories. // Use as: // volume.RegisterPlugin(&FakePlugin{"fake-name"}) -type FakePlugin struct { +type FakeVolumePlugin struct { PluginName string - Host Host + Host VolumeHost } -var _ Plugin = &FakePlugin{} +var _ VolumePlugin = &FakeVolumePlugin{} -func (plugin *FakePlugin) Init(host Host) { +func (plugin *FakeVolumePlugin) Init(host VolumeHost) { plugin.Host = host } -func (plugin *FakePlugin) Name() string { +func (plugin *FakeVolumePlugin) Name() string { return plugin.PluginName } -func (plugin *FakePlugin) CanSupport(spec *api.Volume) bool { +func (plugin *FakeVolumePlugin) CanSupport(spec *api.Volume) bool { // TODO: maybe pattern-match on spec.Name to decide? return true } -func (plugin *FakePlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference) (Builder, error) { +func (plugin *FakeVolumePlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference) (Builder, error) { return &FakeVolume{podRef.UID, spec.Name, plugin}, nil } -func (plugin *FakePlugin) NewCleaner(volName string, podUID types.UID) (Cleaner, error) { +func (plugin *FakeVolumePlugin) NewCleaner(volName string, podUID types.UID) (Cleaner, error) { return &FakeVolume{podUID, volName, plugin}, nil } type FakeVolume struct { PodUID types.UID VolName string - Plugin *FakePlugin + Plugin *FakeVolumePlugin } func (fv *FakeVolume) SetUp() error { diff --git a/pkg/kubelet/volume/volume.go b/pkg/volume/volume.go similarity index 94% rename from pkg/kubelet/volume/volume.go rename to pkg/volume/volume.go index 1ed7cfddb3d5d..7dac95427b728 100644 --- a/pkg/kubelet/volume/volume.go +++ b/pkg/volume/volume.go @@ -22,9 +22,9 @@ import ( "path" ) -// Interface is a directory used by pods or hosts. +// Volume represents a directory used by pods or hosts on a node. // All method implementations of methods in the volume interface must be idempotent. -type Interface interface { +type Volume interface { // GetPath returns the directory path the volume is mounted to. GetPath() string } @@ -32,7 +32,7 @@ type Interface interface { // Builder interface provides method to set up/mount the volume. type Builder interface { // Uses Interface to provide the path for Docker binds. - Interface + Volume // SetUp prepares and mounts/unpacks the volume to a self-determined // directory path. This may be called more than once, so // implementations must be idempotent. @@ -45,7 +45,7 @@ type Builder interface { // Cleaner interface provides method to cleanup/unmount the volumes. type Cleaner interface { - Interface + Volume // TearDown unmounts the volume from a self-determined directory and // removes traces of the SetUp procedure. TearDown() error