Refactor pkg/util/mount to be more reusable

This patch refactors pkg/util/mount to be more usable outside of
Kubernetes. This is done by refactoring mount.Interface to only contain
methods that are not K8s specific. Methods that are not relevant to
basic mount activities but still have OS-specific implementations are
now found in a mount.HostUtils interface.
This commit is contained in:
Travis Rhoden
2019-05-09 16:15:42 -06:00
parent 11abb58a5b
commit be7da5052f
47 changed files with 801 additions and 681 deletions

View File

@@ -162,6 +162,7 @@ func newTestKubeletWithImageList(
kubelet.heartbeatClient = fakeKubeClient
kubelet.os = &containertest.FakeOS{}
kubelet.mounter = &mount.FakeMounter{}
kubelet.hostutil = &mount.FakeHostUtil{}
kubelet.subpather = &subpath.FakeSubpath{}
kubelet.hostname = testKubeletHostname
@@ -312,7 +313,6 @@ func newTestKubeletWithImageList(
NewInitializedVolumePluginMgr(kubelet, kubelet.secretManager, kubelet.configMapManager, token.NewManager(kubelet.kubeClient), allPlugins, prober)
require.NoError(t, err, "Failed to initialize VolumePluginMgr")
kubelet.mounter = &mount.FakeMounter{}
kubelet.volumeManager = kubeletvolume.NewVolumeManager(
controllerAttachDetachEnabled,
kubelet.nodeName,
@@ -322,6 +322,7 @@ func newTestKubeletWithImageList(
kubelet.volumePluginMgr,
fakeRuntime,
kubelet.mounter,
kubelet.hostutil,
kubelet.getPodsDir(),
kubelet.recorder,
false, /* experimentalCheckNodeCapabilitiesBeforeMount*/