mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 14:45:28 +00:00
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:
@@ -372,6 +372,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
||||
|
||||
mounter := mount.New(s.ExperimentalMounterPath)
|
||||
subpather := subpath.New(mounter)
|
||||
hu := mount.NewHostUtil()
|
||||
var pluginRunner = exec.New()
|
||||
if s.Containerized {
|
||||
klog.V(2).Info("Running kubelet in containerized mode")
|
||||
@@ -382,6 +383,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
||||
mounter = nsutil.NewMounter(s.RootDirectory, ne)
|
||||
// NSenter only valid on Linux
|
||||
subpather = subpath.NewNSEnter(mounter, ne, s.RootDirectory)
|
||||
hu = nsutil.NewHostUtil(ne, s.RootDirectory)
|
||||
// an exec interface which can use nsenter for flex plugin calls
|
||||
pluginRunner, err = nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
|
||||
if err != nil {
|
||||
@@ -407,6 +409,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
||||
KubeClient: nil,
|
||||
HeartbeatClient: nil,
|
||||
EventClient: nil,
|
||||
HostUtil: hu,
|
||||
Mounter: mounter,
|
||||
Subpather: subpather,
|
||||
OOMAdjuster: oom.NewOOMAdjuster(),
|
||||
|
Reference in New Issue
Block a user