Merge pull request #54696 from jsafrane/fix-rbd-exec
Automatic merge from submit-queue (batch tested with PRs 54635, 54250, 54657, 54696, 54700). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Don't cache exec and mounter in RBD volume plugin #51608 has broken containerized RBD mount utilities proposed in https://github.com/kubernetes/kubernetes/pull/53440. Volume plugin can get a different exec and mounter implementation with every call, it must not be cached. ```release-note NONE ``` /sig storage /assign @rootfs
This commit is contained in:
@@ -41,14 +41,12 @@ var (
|
||||
|
||||
// This is the primary entrypoint for volume plugins.
|
||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||
return []volume.VolumePlugin{&rbdPlugin{nil, nil, nil}}
|
||||
return []volume.VolumePlugin{&rbdPlugin{}}
|
||||
}
|
||||
|
||||
// rbdPlugin implements Volume.VolumePlugin.
|
||||
type rbdPlugin struct {
|
||||
host volume.VolumeHost
|
||||
exec mount.Exec
|
||||
mounter *mount.SafeFormatAndMount
|
||||
host volume.VolumeHost
|
||||
}
|
||||
|
||||
var _ volume.VolumePlugin = &rbdPlugin{}
|
||||
@@ -74,8 +72,6 @@ func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
||||
|
||||
func (plugin *rbdPlugin) Init(host volume.VolumeHost) error {
|
||||
plugin.host = host
|
||||
plugin.exec = host.GetExec(plugin.GetPluginName())
|
||||
plugin.mounter = volumehelper.NewSafeFormatAndMountFromHost(plugin.GetPluginName(), plugin.host)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -505,8 +501,8 @@ func newRBD(podUID types.UID, volName string, image string, pool string, readOnl
|
||||
Pool: pool,
|
||||
ReadOnly: readOnly,
|
||||
plugin: plugin,
|
||||
mounter: plugin.mounter,
|
||||
exec: plugin.exec,
|
||||
mounter: volumehelper.NewSafeFormatAndMountFromHost(plugin.GetPluginName(), plugin.host),
|
||||
exec: plugin.host.GetExec(plugin.GetPluginName()),
|
||||
manager: manager,
|
||||
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)),
|
||||
}
|
||||
|
Reference in New Issue
Block a user