mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Merge pull request #46458 from jsafrane/mount-prep
Automatic merge from submit-queue (batch tested with PRs 46458, 50934, 50766, 50970, 47698) Prepare VolumeHost for running mount tools in containers This is the first part of implementation of https://github.com/kubernetes/features/issues/278 - running mount utilities in containers. It updates `VolumeHost` interface: * `GetMounter()` now requires volume plugin name, as it is going to return different mounter to different volume plugings, because mount utilities for these plugins can be on different places. * New `GetExec()` method that should volume plugins use to execute any utilities. This new `Exec` interface will execute them on proper place. * `SafeFormatAndMount` is updated to the new `Exec` interface. This is just a preparation, `GetExec` right now leads to simple `os.Exec` and mount utilities are executed on the same place as before. Also, the volume plugins will be updated in subsequent PRs (split into separate PRs, some plugins required lot of changes). ```release-note NONE ``` @kubernetes/sig-storage-pr-reviews @rootfs @gnufied
This commit is contained in:
@@ -49,6 +49,7 @@ type fakeVolumeHost struct {
|
||||
pluginMgr VolumePluginMgr
|
||||
cloud cloudprovider.Interface
|
||||
mounter mount.Interface
|
||||
exec mount.Exec
|
||||
writer io.Writer
|
||||
nodeLabels map[string]string
|
||||
}
|
||||
@@ -71,6 +72,7 @@ func newFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins [
|
||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: cloud}
|
||||
host.mounter = &mount.FakeMounter{}
|
||||
host.writer = &io.StdWriter{}
|
||||
host.exec = mount.NewFakeExec(nil)
|
||||
host.pluginMgr.InitPlugins(plugins, host)
|
||||
return host
|
||||
}
|
||||
@@ -95,7 +97,7 @@ func (f *fakeVolumeHost) GetCloudProvider() cloudprovider.Interface {
|
||||
return f.cloud
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) GetMounter() mount.Interface {
|
||||
func (f *fakeVolumeHost) GetMounter(pluginName string) mount.Interface {
|
||||
return f.mounter
|
||||
}
|
||||
|
||||
@@ -149,6 +151,10 @@ func (f *fakeVolumeHost) GetSecretFunc() func(namespace, name string) (*v1.Secre
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) GetExec(pluginName string) mount.Exec {
|
||||
return f.exec
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) GetConfigMapFunc() func(namespace, name string) (*v1.ConfigMap, error) {
|
||||
return func(namespace, name string) (*v1.ConfigMap, error) {
|
||||
return f.kubeClient.Core().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
|
||||
|
||||
Reference in New Issue
Block a user