Introduce new kubelet volume manager
This commit adds a new volume manager in kubelet that synchronizes volume mount/unmount (and attach/detach, if attach/detach controller is not enabled). This eliminates the race conditions between the pod creation loop and the orphaned volumes loops. It also removes the unmount/detach from the `syncPod()` path so volume clean up never blocks the `syncPod` loop.
This commit is contained in:
@@ -38,7 +38,7 @@ func newTestHost(t *testing.T) (string, volume.VolumeHost) {
|
||||
if err != nil {
|
||||
t.Fatalf("can't make a temp rootdir: %v", err)
|
||||
}
|
||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, nil, empty_dir.ProbeVolumePlugins())
|
||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, nil, empty_dir.ProbeVolumePlugins(), "" /* rootContext */)
|
||||
}
|
||||
|
||||
func TestCanSupport(t *testing.T) {
|
||||
@@ -50,8 +50,8 @@ func TestCanSupport(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Can't find the plugin by name")
|
||||
}
|
||||
if plug.Name() != "kubernetes.io/git-repo" {
|
||||
t.Errorf("Wrong name: %s", plug.Name())
|
||||
if plug.GetPluginName() != "kubernetes.io/git-repo" {
|
||||
t.Errorf("Wrong name: %s", plug.GetPluginName())
|
||||
}
|
||||
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{}}}}) {
|
||||
t.Errorf("Expected true")
|
||||
@@ -230,7 +230,7 @@ func doTestPlugin(scenario struct {
|
||||
return allErrs
|
||||
}
|
||||
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
|
||||
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{RootContext: ""})
|
||||
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{})
|
||||
|
||||
if err != nil {
|
||||
allErrs = append(allErrs,
|
||||
|
||||
Reference in New Issue
Block a user