remove volumeoptions from VolumePlugin and BlockVolumePlugin
This commit is contained in:
		| @@ -798,7 +798,7 @@ func (adc *attachDetachController) GetKubeClient() clientset.Interface { | ||||
| 	return adc.kubeClient | ||||
| } | ||||
|  | ||||
| func (adc *attachDetachController) NewWrapperMounter(volName string, spec volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (adc *attachDetachController) NewWrapperMounter(volName string, spec volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return nil, fmt.Errorf("NewWrapperMounter not supported by Attach/Detach controller's VolumeHost implementation") | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -92,7 +92,7 @@ func (plugin *TestPlugin) RequiresRemount(spec *volume.Spec) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| func (plugin *TestPlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *TestPlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod) (volume.Mounter, error) { | ||||
| 	plugin.pluginLock.Lock() | ||||
| 	defer plugin.pluginLock.Unlock() | ||||
| 	if spec == nil { | ||||
|   | ||||
| @@ -398,7 +398,7 @@ func (expc *expandController) GetKubeClient() clientset.Interface { | ||||
| 	return expc.kubeClient | ||||
| } | ||||
|  | ||||
| func (expc *expandController) NewWrapperMounter(volName string, spec volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (expc *expandController) NewWrapperMounter(volName string, spec volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return nil, fmt.Errorf("NewWrapperMounter not supported by expand controller's VolumeHost implementation") | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1010,7 +1010,7 @@ func (plugin *mockVolumePlugin) SupportsSELinuxContextMount(spec *volume.Spec) ( | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *mockVolumePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *mockVolumePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod) (volume.Mounter, error) { | ||||
| 	return nil, fmt.Errorf("Mounter is not supported by this plugin") | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -65,7 +65,7 @@ func (ctrl *PersistentVolumeController) GetKubeClient() clientset.Interface { | ||||
| 	return ctrl.kubeClient | ||||
| } | ||||
|  | ||||
| func (ctrl *PersistentVolumeController) NewWrapperMounter(volName string, spec vol.Spec, pod *v1.Pod, opts vol.VolumeOptions) (vol.Mounter, error) { | ||||
| func (ctrl *PersistentVolumeController) NewWrapperMounter(volName string, spec vol.Spec, pod *v1.Pod) (vol.Mounter, error) { | ||||
| 	return nil, fmt.Errorf("PersistentVolumeController.NewWrapperMounter is not implemented") | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -100,12 +100,12 @@ func (kl *Kubelet) podVolumesExist(podUID types.UID) bool { | ||||
| // newVolumeMounterFromPlugins attempts to find a plugin by volume spec, pod | ||||
| // and volume options and then creates a Mounter. | ||||
| // Returns a valid mounter or an error. | ||||
| func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	plugin, err := kl.volumePluginMgr.FindPluginBySpec(spec) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("can't use volume plugins for %s: %v", spec.Name(), err) | ||||
| 	} | ||||
| 	physicalMounter, err := plugin.NewMounter(spec, pod, opts) | ||||
| 	physicalMounter, err := plugin.NewMounter(spec, pod) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to instantiate mounter for volume: %s using plugin: %s with a root cause: %v", spec.Name(), plugin.GetPluginName(), err) | ||||
| 	} | ||||
|   | ||||
| @@ -190,15 +190,14 @@ func (kvh *kubeletVolumeHost) WaitForCacheSync() error { | ||||
| func (kvh *kubeletVolumeHost) NewWrapperMounter( | ||||
| 	volName string, | ||||
| 	spec volume.Spec, | ||||
| 	pod *v1.Pod, | ||||
| 	opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| 	pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	// The name of wrapper volume is set to "wrapped_{wrapped_volume_name}" | ||||
| 	wrapperVolumeName := "wrapped_" + volName | ||||
| 	if spec.Volume != nil { | ||||
| 		spec.Volume.Name = wrapperVolumeName | ||||
| 	} | ||||
|  | ||||
| 	return kvh.kubelet.newVolumeMounterFromPlugins(&spec, pod, opts) | ||||
| 	return kvh.kubelet.newVolumeMounterFromPlugins(&spec, pod) | ||||
| } | ||||
|  | ||||
| func (kvh *kubeletVolumeHost) NewWrapperUnmounter(volName string, spec volume.Spec, podUID types.UID) (volume.Unmounter, error) { | ||||
|   | ||||
| @@ -220,12 +220,12 @@ func Test_AddPodToVolume_Positive_ExistingVolumeNewNode(t *testing.T) { | ||||
| 	} | ||||
| 	podName := util.GetUniquePodName(pod) | ||||
|  | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -296,12 +296,12 @@ func Test_AddPodToVolume_Positive_ExistingVolumeExistingNode(t *testing.T) { | ||||
| 	} | ||||
| 	podName := util.GetUniquePodName(pod) | ||||
|  | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -404,12 +404,12 @@ func Test_AddTwoPodsToVolume_Positive(t *testing.T) { | ||||
| 	} | ||||
| 	podName1 := util.GetUniquePodName(pod1) | ||||
|  | ||||
| 	mounter1, err := plugin.NewMounter(volumeSpec1, pod1, volume.VolumeOptions{}) | ||||
| 	mounter1, err := plugin.NewMounter(volumeSpec1, pod1) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper1, err := plugin.NewBlockVolumeMapper(volumeSpec1, pod1, volume.VolumeOptions{}) | ||||
| 	mapper1, err := plugin.NewBlockVolumeMapper(volumeSpec1, pod1) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -430,12 +430,12 @@ func Test_AddTwoPodsToVolume_Positive(t *testing.T) { | ||||
|  | ||||
| 	podName2 := util.GetUniquePodName(pod2) | ||||
|  | ||||
| 	mounter2, err := plugin.NewMounter(volumeSpec2, pod2, volume.VolumeOptions{}) | ||||
| 	mounter2, err := plugin.NewMounter(volumeSpec2, pod2) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper2, err := plugin.NewBlockVolumeMapper(volumeSpec2, pod2, volume.VolumeOptions{}) | ||||
| 	mapper2, err := plugin.NewBlockVolumeMapper(volumeSpec2, pod2) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -591,12 +591,12 @@ func TestActualStateOfWorld_FoundDuringReconstruction(t *testing.T) { | ||||
| 			} | ||||
| 			podName1 := util.GetUniquePodName(pod1) | ||||
|  | ||||
| 			mounter1, err := plugin.NewMounter(volumeSpec1, pod1, volume.VolumeOptions{}) | ||||
| 			mounter1, err := plugin.NewMounter(volumeSpec1, pod1) | ||||
| 			if err != nil { | ||||
| 				t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 			} | ||||
|  | ||||
| 			mapper1, err := plugin.NewBlockVolumeMapper(volumeSpec1, pod1, volume.VolumeOptions{}) | ||||
| 			mapper1, err := plugin.NewBlockVolumeMapper(volumeSpec1, pod1) | ||||
| 			if err != nil { | ||||
| 				t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 			} | ||||
| @@ -675,12 +675,12 @@ func Test_MarkVolumeAsDetached_Negative_PodInVolume(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	podName := util.GetUniquePodName(pod) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -781,12 +781,12 @@ func Test_AddPodToVolume_Negative_VolumeDoesntExist(t *testing.T) { | ||||
|  | ||||
| 	podName := util.GetUniquePodName(pod) | ||||
|  | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := blockplugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := blockplugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -912,12 +912,12 @@ func Test_AddPodToVolume_Positive_SELinux(t *testing.T) { | ||||
| 	} | ||||
| 	podName := util.GetUniquePodName(pod) | ||||
|  | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
| @@ -1037,7 +1037,7 @@ func TestUncertainVolumeMounts(t *testing.T) { | ||||
| 	} | ||||
| 	podName1 := util.GetUniquePodName(pod1) | ||||
|  | ||||
| 	mounter1, err := plugin.NewMounter(volumeSpec1, pod1, volume.VolumeOptions{}) | ||||
| 	mounter1, err := plugin.NewMounter(volumeSpec1, pod1) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|   | ||||
| @@ -17,9 +17,10 @@ limitations under the License. | ||||
| package metrics | ||||
|  | ||||
| import ( | ||||
| 	"k8s.io/klog/v2/ktesting" | ||||
| 	"testing" | ||||
|  | ||||
| 	"k8s.io/klog/v2/ktesting" | ||||
|  | ||||
| 	v1 "k8s.io/api/core/v1" | ||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||
| 	k8stypes "k8s.io/apimachinery/pkg/types" | ||||
| @@ -63,12 +64,12 @@ func TestMetricCollection(t *testing.T) { | ||||
| 		t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mounter, err := fakePlugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := fakePlugin.NewMounter(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|  | ||||
| 	mapper, err := fakePlugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := fakePlugin.NewBlockVolumeMapper(volumeSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) | ||||
| 	} | ||||
|   | ||||
| @@ -340,8 +340,7 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (rvolume *reconstructe | ||||
| 		var newMapperErr error | ||||
| 		volumeMapper, newMapperErr = mapperPlugin.NewBlockVolumeMapper( | ||||
| 			volumeSpec, | ||||
| 			pod, | ||||
| 			volumepkg.VolumeOptions{}) | ||||
| 			pod) | ||||
| 		if newMapperErr != nil { | ||||
| 			return nil, fmt.Errorf( | ||||
| 				"reconstructVolume.NewBlockVolumeMapper failed for volume %q (spec.Name: %q) pod %q (UID: %q) with: %v", | ||||
| @@ -353,10 +352,7 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (rvolume *reconstructe | ||||
| 		} | ||||
| 	} else { | ||||
| 		var err error | ||||
| 		volumeMounter, err = plugin.NewMounter( | ||||
| 			volumeSpec, | ||||
| 			pod, | ||||
| 			volumepkg.VolumeOptions{}) | ||||
| 		volumeMounter, err = plugin.NewMounter(volumeSpec, pod) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf( | ||||
| 				"reconstructVolume.NewMounter failed for volume %q (spec.Name: %q) pod %q (UID: %q) with: %v", | ||||
|   | ||||
| @@ -90,7 +90,7 @@ func (plugin *configMapPlugin) SupportsSELinuxContextMount(spec *volume.Spec) (b | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return &configMapVolumeMounter{ | ||||
| 		configMapVolume: &configMapVolume{ | ||||
| 			spec.Name(), | ||||
| @@ -101,7 +101,6 @@ func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts v | ||||
| 		}, | ||||
| 		source:       *spec.Volume.ConfigMap, | ||||
| 		pod:          *pod, | ||||
| 		opts:         &opts, | ||||
| 		getConfigMap: plugin.getConfigMap, | ||||
| 	}, nil | ||||
| } | ||||
| @@ -151,7 +150,6 @@ type configMapVolumeMounter struct { | ||||
|  | ||||
| 	source       v1.ConfigMapVolumeSource | ||||
| 	pod          v1.Pod | ||||
| 	opts         *volume.VolumeOptions | ||||
| 	getConfigMap func(namespace, name string) (*v1.ConfigMap, error) | ||||
| } | ||||
|  | ||||
| @@ -183,7 +181,7 @@ func (b *configMapVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterA | ||||
| 	klog.V(3).Infof("Setting up volume %v for pod %v at %v", b.volName, b.pod.UID, dir) | ||||
|  | ||||
| 	// Wrap EmptyDir, let it do the setup. | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod, *b.opts) | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -344,7 +344,7 @@ func TestPlugin(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -410,7 +410,7 @@ func TestPluginReboot(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -468,7 +468,7 @@ func TestPluginOptional(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -567,7 +567,7 @@ func TestPluginKeysOptional(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -647,7 +647,7 @@ func TestInvalidConfigMapSetup(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
|   | ||||
| @@ -42,7 +42,6 @@ func prepareBlockMapperTest(plug *csiPlugin, specVolumeName string, t *testing.T | ||||
| 	mapper, err := plug.NewBlockVolumeMapper( | ||||
| 		spec, | ||||
| 		&api.Pod{ObjectMeta: metav1.ObjectMeta{UID: testPodUID, Namespace: testns, Name: testPod}}, | ||||
| 		volume.VolumeOptions{}, | ||||
| 	) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, nil, fmt.Errorf("failed to make a new Mapper: %w", err) | ||||
|   | ||||
| @@ -108,7 +108,6 @@ func TestMounterGetPath(t *testing.T) { | ||||
| 		mounter, err := plug.NewMounter( | ||||
| 			spec, | ||||
| 			&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}}, | ||||
| 			volume.VolumeOptions{}, | ||||
| 		) | ||||
| 		if err != nil { | ||||
| 			t.Fatalf("Failed to make a new Mounter: %v", err) | ||||
| @@ -244,7 +243,6 @@ func TestMounterSetUp(t *testing.T) { | ||||
| 						ServiceAccountName: testAccount, | ||||
| 					}, | ||||
| 				}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if err != nil { | ||||
| 				t.Fatalf("failed to make a new Mounter: %v", err) | ||||
| @@ -441,7 +439,6 @@ func TestMounterSetUpSimple(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				tc.spec(tc.fsType, tc.options), | ||||
| 				&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: tc.podUID, Namespace: testns}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if tc.newMounterShouldFail && err != nil { | ||||
| 				t.Log(err) | ||||
| @@ -623,7 +620,6 @@ func TestMounterSetupWithStatusTracking(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				tc.spec("ext4", []string{}), | ||||
| 				&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: tc.podUID, Namespace: testns}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if err != nil { | ||||
| 				t.Fatalf("failed to create CSI mounter: %v", err) | ||||
| @@ -724,7 +720,6 @@ func TestMounterSetUpWithInline(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				tc.spec(tc.fsType, tc.options), | ||||
| 				&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: tc.podUID, Namespace: testns}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if tc.shouldFail && err != nil { | ||||
| 				t.Log(err) | ||||
| @@ -988,7 +983,6 @@ func TestMounterSetUpWithFSGroup(t *testing.T) { | ||||
| 		mounter, err := plug.NewMounter( | ||||
| 			spec, | ||||
| 			&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}}, | ||||
| 			volume.VolumeOptions{}, | ||||
| 		) | ||||
| 		if err != nil { | ||||
| 			t.Fatalf("Failed to make a new Mounter: %v", err) | ||||
| @@ -1272,7 +1266,6 @@ func TestPodServiceAccountTokenAttrs(t *testing.T) { | ||||
| 						ServiceAccountName: testAccount, | ||||
| 					}, | ||||
| 				}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if err != nil { | ||||
| 				t.Fatalf("Failed to create a csi mounter, err: %v", err) | ||||
| @@ -1489,7 +1482,6 @@ func TestMounterGetFSGroupPolicy(t *testing.T) { | ||||
| 		mounter, err := plug.NewMounter( | ||||
| 			volume.NewSpecFromPersistentVolume(makeTestPV("test.vol.id", 20, testDriver, "testvol-handle1"), true), | ||||
| 			&corev1.Pod{ObjectMeta: meta.ObjectMeta{UID: "1", Namespace: testns}}, | ||||
| 			volume.VolumeOptions{}, | ||||
| 		) | ||||
| 		if err != nil { | ||||
| 			t.Fatalf("Error creating a new mounter: %s", err) | ||||
|   | ||||
| @@ -367,8 +367,7 @@ func (p *csiPlugin) RequiresRemount(spec *volume.Spec) bool { | ||||
|  | ||||
| func (p *csiPlugin) NewMounter( | ||||
| 	spec *volume.Spec, | ||||
| 	pod *api.Pod, | ||||
| 	_ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| 	pod *api.Pod) (volume.Mounter, error) { | ||||
|  | ||||
| 	volSrc, pvSrc, err := getSourceFromSpec(spec) | ||||
| 	if err != nil { | ||||
| @@ -621,7 +620,7 @@ func (p *csiPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) | ||||
| // BlockVolumePlugin methods | ||||
| var _ volume.BlockVolumePlugin = &csiPlugin{} | ||||
|  | ||||
| func (p *csiPlugin) NewBlockVolumeMapper(spec *volume.Spec, podRef *api.Pod, opts volume.VolumeOptions) (volume.BlockVolumeMapper, error) { | ||||
| func (p *csiPlugin) NewBlockVolumeMapper(spec *volume.Spec, podRef *api.Pod) (volume.BlockVolumeMapper, error) { | ||||
| 	pvSource, err := getCSISourceFromSpec(spec) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
|   | ||||
| @@ -375,7 +375,6 @@ func TestPluginConstructVolumeSpec(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				tc.originSpec, | ||||
| 				&api.Pod{ObjectMeta: meta.ObjectMeta{UID: tc.podUID, Namespace: testns}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if err != nil { | ||||
| 				t.Fatal(err) | ||||
| @@ -509,7 +508,6 @@ func TestPluginConstructVolumeSpecWithInline(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				tc.originSpec, | ||||
| 				&api.Pod{ObjectMeta: meta.ObjectMeta{UID: tc.podUID, Namespace: testns}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if tc.shouldFail && err != nil { | ||||
| 				t.Log(err) | ||||
| @@ -616,7 +614,6 @@ func TestPluginNewMounter(t *testing.T) { | ||||
| 			mounter, err := plug.NewMounter( | ||||
| 				test.spec, | ||||
| 				&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}}, | ||||
| 				volume.VolumeOptions{}, | ||||
| 			) | ||||
| 			if test.shouldFail != (err != nil) { | ||||
| 				t.Fatal("Unexpected error:", err) | ||||
| @@ -719,7 +716,6 @@ func TestPluginNewMounterWithInline(t *testing.T) { | ||||
| 				mounter, err := plug.NewMounter( | ||||
| 					test.spec, | ||||
| 					&api.Pod{ObjectMeta: meta.ObjectMeta{UID: test.podUID, Namespace: test.namespace}}, | ||||
| 					volume.VolumeOptions{}, | ||||
| 				) | ||||
|  | ||||
| 				// Some test cases are meant to fail because their input data is broken. | ||||
| @@ -1113,7 +1109,6 @@ func TestPluginNewBlockMapper(t *testing.T) { | ||||
| 	mounter, err := plug.NewBlockVolumeMapper( | ||||
| 		volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly), | ||||
| 		&api.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}}, | ||||
| 		volume.VolumeOptions{}, | ||||
| 	) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("Failed to make a new BlockMapper: %v", err) | ||||
|   | ||||
| @@ -398,7 +398,7 @@ func TestCSI_VolumeAll(t *testing.T) { | ||||
| 				t.Fatal("csiTest.VolumeAll volumePlugin.CanSupport returned false") | ||||
| 			} | ||||
|  | ||||
| 			mounter, err := volPlug.NewMounter(volSpec, pod, volume.VolumeOptions{}) | ||||
| 			mounter, err := volPlug.NewMounter(volSpec, pod) | ||||
| 			if err != nil || mounter == nil { | ||||
| 				t.Fatalf("csiTest.VolumeAll volPlugin.NewMounter is nil or error: %s", err) | ||||
| 			} | ||||
| @@ -485,7 +485,7 @@ func TestCSI_VolumeAll(t *testing.T) { | ||||
| 			if volPlug == nil { | ||||
| 				t.Fatalf("csiTest.VolumeAll volumePlugin is nil") | ||||
| 			} | ||||
| 			mounter, err = volPlug.NewMounter(volSpec, pod, volume.VolumeOptions{}) | ||||
| 			mounter, err = volPlug.NewMounter(volSpec, pod) | ||||
| 			if err != nil || mounter == nil { | ||||
| 				t.Fatalf("csiTest.VolumeAll volPlugin.NewMounter is nil or error: %s", err) | ||||
| 			} | ||||
|   | ||||
| @@ -92,7 +92,7 @@ func (plugin *downwardAPIPlugin) SupportsSELinuxContextMount(spec *volume.Spec) | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *downwardAPIPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *downwardAPIPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	v := &downwardAPIVolume{ | ||||
| 		volName:         spec.Name(), | ||||
| 		items:           spec.Volume.DownwardAPI.Items, | ||||
| @@ -104,7 +104,6 @@ func (plugin *downwardAPIPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts | ||||
| 	return &downwardAPIVolumeMounter{ | ||||
| 		downwardAPIVolume: v, | ||||
| 		source:            *spec.Volume.DownwardAPI, | ||||
| 		opts:              &opts, | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| @@ -146,7 +145,6 @@ type downwardAPIVolume struct { | ||||
| type downwardAPIVolumeMounter struct { | ||||
| 	*downwardAPIVolume | ||||
| 	source v1.DownwardAPIVolumeSource | ||||
| 	opts   *volume.VolumeOptions | ||||
| } | ||||
|  | ||||
| // downwardAPIVolumeMounter implements volume.Mounter interface | ||||
| @@ -172,7 +170,7 @@ func (b *downwardAPIVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error { | ||||
| func (b *downwardAPIVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) error { | ||||
| 	klog.V(3).Infof("Setting up a downwardAPI volume %v for pod %v/%v at %v", b.volName, b.pod.Namespace, b.pod.Name, dir) | ||||
| 	// Wrap EmptyDir. Here we rely on the idempotency of the wrapped plugin to avoid repeatedly mounting | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), b.pod, *b.opts) | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), b.pod) | ||||
| 	if err != nil { | ||||
| 		klog.Errorf("Couldn't setup downwardAPI volume %v for pod %v/%v: %s", b.volName, b.pod.Namespace, b.pod.Name, err.Error()) | ||||
| 		return err | ||||
|   | ||||
| @@ -248,7 +248,7 @@ func newDownwardAPITest(t *testing.T, name string, volumeFiles, podLabels, podAn | ||||
| 	} | ||||
| 	podMeta.UID = testPodUID | ||||
| 	pod := &v1.Pod{ObjectMeta: podMeta} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
|   | ||||
| @@ -105,8 +105,8 @@ func (plugin *emptyDirPlugin) SupportsSELinuxContextMount(spec *volume.Spec) (bo | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *emptyDirPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| 	return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), &realMountDetector{plugin.host.GetMounter(plugin.GetPluginName())}, opts) | ||||
| func (plugin *emptyDirPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), &realMountDetector{plugin.host.GetMounter(plugin.GetPluginName())}) | ||||
| } | ||||
|  | ||||
| func calculateEmptyDirMemorySize(nodeAllocatableMemory *resource.Quantity, spec *volume.Spec, pod *v1.Pod) *resource.Quantity { | ||||
| @@ -143,7 +143,7 @@ func calculateEmptyDirMemorySize(nodeAllocatableMemory *resource.Quantity, spec | ||||
| 	return sizeLimit | ||||
| } | ||||
|  | ||||
| func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface, mountDetector mountDetector, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface, mountDetector mountDetector) (volume.Mounter, error) { | ||||
| 	medium := v1.StorageMediumDefault | ||||
| 	sizeLimit := &resource.Quantity{} | ||||
| 	if spec.Volume.EmptyDir != nil { // Support a non-specified source as EmptyDir. | ||||
|   | ||||
| @@ -193,8 +193,7 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) { | ||||
| 	mounter, err := plug.(*emptyDirPlugin).newMounterInternal(volume.NewSpecFromVolume(spec), | ||||
| 		pod, | ||||
| 		physicalMounter, | ||||
| 		&mountDetector, | ||||
| 		volume.VolumeOptions{}) | ||||
| 		&mountDetector) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -313,7 +312,7 @@ func TestPluginBackCompat(t *testing.T) { | ||||
| 		Name: "vol1", | ||||
| 	} | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -342,7 +341,7 @@ func TestMetrics(t *testing.T) { | ||||
| 		Name: "vol1", | ||||
| 	} | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
|   | ||||
| @@ -108,7 +108,7 @@ func (plugin *fcPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (plugin *fcPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *fcPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	// Inject real implementations here, test through the internal function. | ||||
| 	return plugin.newMounterInternal(spec, pod.UID, &fcUtil{}, plugin.host.GetMounter(plugin.GetPluginName()), plugin.host.GetExec(plugin.GetPluginName())) | ||||
| } | ||||
| @@ -153,7 +153,7 @@ func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func (plugin *fcPlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.BlockVolumeMapper, error) { | ||||
| func (plugin *fcPlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod) (volume.BlockVolumeMapper, error) { | ||||
| 	// If this called via GenerateUnmapDeviceFunc(), pod is nil. | ||||
| 	// Pass empty string as dummy uid since uid isn't used in the case. | ||||
| 	var uid types.UID | ||||
|   | ||||
| @@ -384,7 +384,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
| 	// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes | ||||
| 	spec := volume.NewSpecFromPersistentVolume(pv, true) | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, _ := plug.NewMounter(spec, pod) | ||||
| 	if mounter == nil { | ||||
| 		t.Fatalf("Got a nil Mounter") | ||||
| 	} | ||||
|   | ||||
| @@ -161,7 +161,7 @@ func (plugin *flexVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMod | ||||
| } | ||||
|  | ||||
| // NewMounter is part of the volume.VolumePlugin interface. | ||||
| func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod) (volume.Mounter, error) { | ||||
| 	return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName()), plugin.runner) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -89,7 +89,7 @@ func (plugin *gitRepoPlugin) SupportsSELinuxContextMount(spec *volume.Spec) (boo | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *gitRepoPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *gitRepoPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	if err := validateVolume(spec.Volume.GitRepo); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| @@ -105,7 +105,6 @@ func (plugin *gitRepoPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts vol | ||||
| 		revision: spec.Volume.GitRepo.Revision, | ||||
| 		target:   spec.Volume.GitRepo.Directory, | ||||
| 		exec:     exec.New(), | ||||
| 		opts:     opts, | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| @@ -156,7 +155,6 @@ type gitRepoVolumeMounter struct { | ||||
| 	revision string | ||||
| 	target   string | ||||
| 	exec     exec.Interface | ||||
| 	opts     volume.VolumeOptions | ||||
| } | ||||
|  | ||||
| var _ volume.Mounter = &gitRepoVolumeMounter{} | ||||
| @@ -181,7 +179,7 @@ func (b *gitRepoVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArg | ||||
| 	} | ||||
|  | ||||
| 	// Wrap EmptyDir, let it do the setup. | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod, b.opts) | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -315,7 +315,7 @@ func doTestPlugin(scenario struct { | ||||
| 		return allErrs | ||||
| 	} | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		allErrs = append(allErrs, | ||||
|   | ||||
| @@ -118,7 +118,7 @@ func (plugin *hostPathPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (plugin *hostPathPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *hostPathPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	hostPathVolumeSource, readOnly, err := getVolumeSource(spec) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
|   | ||||
| @@ -215,7 +215,7 @@ func TestInvalidHostPath(t *testing.T) { | ||||
| 		VolumeSource: v1.VolumeSource{HostPath: &v1.HostPathVolumeSource{Path: "/no/backsteps/allowed/.."}}, | ||||
| 	} | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| @@ -243,7 +243,7 @@ func TestPlugin(t *testing.T) { | ||||
| 	} | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	defer os.RemoveAll(volPath) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -311,7 +311,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
| 	// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes | ||||
| 	spec := volume.NewSpecFromPersistentVolume(pv, true) | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, _ := plug.NewMounter(spec, pod) | ||||
| 	if mounter == nil { | ||||
| 		t.Fatalf("Got a nil Mounter") | ||||
| 	} | ||||
|   | ||||
| @@ -52,7 +52,7 @@ func (o *imagePlugin) CanSupport(spec *volume.Spec) bool { | ||||
| 	return spec.Volume.Image != nil | ||||
| } | ||||
|  | ||||
| func (o *imagePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (o *imagePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod) (volume.Mounter, error) { | ||||
| 	return o, nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -101,7 +101,7 @@ func (plugin *iscsiPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	if pod == nil { | ||||
| 		return nil, fmt.Errorf("nil pod") | ||||
| 	} | ||||
| @@ -139,7 +139,7 @@ func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UI | ||||
| } | ||||
|  | ||||
| // NewBlockVolumeMapper creates a new volume.BlockVolumeMapper from an API specification. | ||||
| func (plugin *iscsiPlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.BlockVolumeMapper, error) { | ||||
| func (plugin *iscsiPlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod) (volume.BlockVolumeMapper, error) { | ||||
| 	// If this is called via GenerateUnmapDeviceFunc(), pod is nil. | ||||
| 	// Pass empty string as dummy uid since uid isn't used in the case. | ||||
| 	var uid types.UID | ||||
|   | ||||
| @@ -24,7 +24,7 @@ import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"k8s.io/mount-utils" | ||||
| 	"k8s.io/utils/exec/testing" | ||||
| 	testingexec "k8s.io/utils/exec/testing" | ||||
|  | ||||
| 	v1 "k8s.io/api/core/v1" | ||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||
| @@ -289,7 +289,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
| 	// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes | ||||
| 	spec := volume.NewSpecFromPersistentVolume(pv, true) | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, _ := plug.NewMounter(spec, pod) | ||||
| 	if mounter == nil { | ||||
| 		t.Fatalf("Got a nil Mounter") | ||||
| 	} | ||||
|   | ||||
| @@ -111,7 +111,7 @@ func getVolumeSource(spec *volume.Spec) (*v1.LocalVolumeSource, bool, error) { | ||||
| 	return nil, false, fmt.Errorf("Spec does not reference a Local volume type") | ||||
| } | ||||
|  | ||||
| func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	_, readOnly, err := getVolumeSource(spec) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| @@ -155,8 +155,7 @@ func (plugin *localVolumePlugin) NewUnmounter(volName string, podUID types.UID) | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func (plugin *localVolumePlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, | ||||
| 	_ volume.VolumeOptions) (volume.BlockVolumeMapper, error) { | ||||
| func (plugin *localVolumePlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod) (volume.BlockVolumeMapper, error) { | ||||
| 	volumeSource, readOnly, err := getVolumeSource(spec) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
|   | ||||
| @@ -241,7 +241,7 @@ func TestInvalidLocalPath(t *testing.T) { | ||||
| 	defer os.RemoveAll(tmpDir) | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, "/no/backsteps/allowed/..", false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, "/no/backsteps/allowed/..", false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| @@ -361,7 +361,7 @@ func TestMountUnmount(t *testing.T) { | ||||
| 	defer os.RemoveAll(tmpDir) | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -415,7 +415,7 @@ func TestMapUnmap(t *testing.T) { | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	volSpec := getTestVolume(false, tmpDir, true /*isBlock*/, nil) | ||||
| 	mapper, err := plug.NewBlockVolumeMapper(volSpec, pod, volume.VolumeOptions{}) | ||||
| 	mapper, err := plug.NewBlockVolumeMapper(volSpec, pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -480,7 +480,7 @@ func TestMapUnmap(t *testing.T) { | ||||
| } | ||||
|  | ||||
| func testFSGroupMount(plug volume.VolumePlugin, pod *v1.Pod, tmpDir string, fsGroup int64) error { | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| @@ -642,7 +642,7 @@ func TestMountOptions(t *testing.T) { | ||||
| 	defer os.RemoveAll(tmpDir) | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, []string{"test-option"}), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, []string{"test-option"}), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -670,7 +670,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
|  | ||||
| 	// Read only == true | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(true, tmpDir, false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(true, tmpDir, false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -682,7 +682,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	// Read only == false | ||||
| 	mounter, err = plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err = plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -731,7 +731,7 @@ func TestFilterPodMounts(t *testing.T) { | ||||
| 	defer os.RemoveAll(tmpDir) | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plug.NewMounter(getTestVolume(false, tmpDir, false, nil), pod) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
|   | ||||
| @@ -113,7 +113,7 @@ func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (plugin *nfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *nfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(plugin.GetPluginName())) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -269,7 +269,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { | ||||
| 	// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes | ||||
| 	spec := volume.NewSpecFromPersistentVolume(pv, true) | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} | ||||
| 	mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) | ||||
| 	mounter, _ := plug.NewMounter(spec, pod) | ||||
| 	if mounter == nil { | ||||
| 		t.Fatalf("Got a nil Mounter") | ||||
| 	} | ||||
|   | ||||
| @@ -52,7 +52,7 @@ func (n *noopExpandableVolumePluginInstance) RequiresRemount(spec *Spec) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| func (n *noopExpandableVolumePluginInstance) NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error) { | ||||
| func (n *noopExpandableVolumePluginInstance) NewMounter(spec *Spec, podRef *v1.Pod) (Mounter, error) { | ||||
| 	return nil, nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -149,7 +149,7 @@ type VolumePlugin interface { | ||||
| 	// Ownership of the spec pointer in *not* transferred. | ||||
| 	// - spec: The v1.Volume spec | ||||
| 	// - pod: The enclosing pod | ||||
| 	NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error) | ||||
| 	NewMounter(spec *Spec, podRef *v1.Pod) (Mounter, error) | ||||
|  | ||||
| 	// NewUnmounter creates a new volume.Unmounter from recoverable state. | ||||
| 	// - name: The volume name, as per the v1.Volume spec. | ||||
| @@ -260,7 +260,7 @@ type BlockVolumePlugin interface { | ||||
| 	// Ownership of the spec pointer in *not* transferred. | ||||
| 	// - spec: The v1.Volume spec | ||||
| 	// - pod: The enclosing pod | ||||
| 	NewBlockVolumeMapper(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (BlockVolumeMapper, error) | ||||
| 	NewBlockVolumeMapper(spec *Spec, podRef *v1.Pod) (BlockVolumeMapper, error) | ||||
| 	// NewBlockVolumeUnmapper creates a new volume.BlockVolumeUnmapper from recoverable state. | ||||
| 	// - name: The volume name, as per the v1.Volume spec. | ||||
| 	// - podUID: The UID of the enclosing pod | ||||
| @@ -365,7 +365,7 @@ type VolumeHost interface { | ||||
| 	// the provided spec.  This is used to implement volume plugins which | ||||
| 	// "wrap" other plugins.  For example, the "secret" volume is | ||||
| 	// implemented in terms of the "emptyDir" volume. | ||||
| 	NewWrapperMounter(volName string, spec Spec, pod *v1.Pod, opts VolumeOptions) (Mounter, error) | ||||
| 	NewWrapperMounter(volName string, spec Spec, pod *v1.Pod) (Mounter, error) | ||||
|  | ||||
| 	// NewWrapperUnmounter finds an appropriate plugin with which to handle | ||||
| 	// the provided spec.  See comments on NewWrapperMounter for more | ||||
|   | ||||
| @@ -87,7 +87,7 @@ func (plugin *testPlugins) SupportsSELinuxContextMount(spec *Spec) (bool, error) | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *testPlugins) NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error) { | ||||
| func (plugin *testPlugins) NewMounter(spec *Spec, podRef *v1.Pod) (Mounter, error) { | ||||
| 	return nil, nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -115,7 +115,7 @@ func (plugin *portworxVolumePlugin) GetAccessModes() []v1.PersistentVolumeAccess | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (plugin *portworxVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *portworxVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return plugin.newMounterInternal(spec, pod.UID, plugin.util, plugin.host.GetMounter(plugin.GetPluginName())) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -107,7 +107,7 @@ func (plugin *projectedPlugin) SupportsSELinuxContextMount(spec *volume.Spec) (b | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *projectedPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *projectedPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return &projectedVolumeMounter{ | ||||
| 		projectedVolume: &projectedVolume{ | ||||
| 			volName:         spec.Name(), | ||||
| @@ -118,7 +118,6 @@ func (plugin *projectedPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts v | ||||
| 		}, | ||||
| 		source: *spec.Volume.Projected, | ||||
| 		pod:    pod, | ||||
| 		opts:   &opts, | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| @@ -165,7 +164,6 @@ type projectedVolumeMounter struct { | ||||
|  | ||||
| 	source v1.ProjectedVolumeSource | ||||
| 	pod    *v1.Pod | ||||
| 	opts   *volume.VolumeOptions | ||||
| } | ||||
|  | ||||
| var _ volume.Mounter = &projectedVolumeMounter{} | ||||
| @@ -186,7 +184,7 @@ func (s *projectedVolumeMounter) SetUp(mounterArgs volume.MounterArgs) error { | ||||
| func (s *projectedVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) error { | ||||
| 	klog.V(3).Infof("Setting up volume %v for pod %v at %v", s.volName, s.pod.UID, dir) | ||||
|  | ||||
| 	wrapped, err := s.plugin.host.NewWrapperMounter(s.volName, wrappedVolumeSpec(), s.pod, *s.opts) | ||||
| 	wrapped, err := s.plugin.host.NewWrapperMounter(s.volName, wrappedVolumeSpec(), s.pod) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -1090,7 +1090,7 @@ func TestPlugin(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -1155,7 +1155,7 @@ func TestInvalidPathProjected(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -1205,7 +1205,7 @@ func TestPluginReboot(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -1259,7 +1259,7 @@ func TestPluginOptional(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -1357,7 +1357,7 @@ func TestPluginOptionalKeys(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
|   | ||||
| @@ -93,7 +93,7 @@ func (plugin *secretPlugin) SupportsSELinuxContextMount(spec *volume.Spec) (bool | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return &secretVolumeMounter{ | ||||
| 		secretVolume: &secretVolume{ | ||||
| 			spec.Name(), | ||||
| @@ -104,7 +104,6 @@ func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volu | ||||
| 		}, | ||||
| 		source:    *spec.Volume.Secret, | ||||
| 		pod:       *pod, | ||||
| 		opts:      &opts, | ||||
| 		getSecret: plugin.getSecret, | ||||
| 	}, nil | ||||
| } | ||||
| @@ -156,7 +155,6 @@ type secretVolumeMounter struct { | ||||
|  | ||||
| 	source    v1.SecretVolumeSource | ||||
| 	pod       v1.Pod | ||||
| 	opts      *volume.VolumeOptions | ||||
| 	getSecret func(namespace, name string) (*v1.Secret, error) | ||||
| } | ||||
|  | ||||
| @@ -178,7 +176,7 @@ func (b *secretVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs | ||||
| 	klog.V(3).Infof("Setting up volume %v for pod %v at %v", b.volName, b.pod.UID, dir) | ||||
|  | ||||
| 	// Wrap EmptyDir, let it do the setup. | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod, *b.opts) | ||||
| 	wrapped, err := b.plugin.host.NewWrapperMounter(b.volName, wrappedVolumeSpec(), &b.pod) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -26,7 +26,7 @@ import ( | ||||
| 	"strings" | ||||
| 	"testing" | ||||
|  | ||||
| 	"k8s.io/api/core/v1" | ||||
| 	v1 "k8s.io/api/core/v1" | ||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||
| 	"k8s.io/apimachinery/pkg/types" | ||||
| 	clientset "k8s.io/client-go/kubernetes" | ||||
| @@ -314,7 +314,7 @@ func TestPlugin(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -388,7 +388,7 @@ func TestInvalidPathSecret(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -438,7 +438,7 @@ func TestPluginReboot(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -492,7 +492,7 @@ func TestPluginOptional(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
| @@ -590,7 +590,7 @@ func TestPluginOptionalKeys(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) | ||||
| 	mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod) | ||||
| 	if err != nil { | ||||
| 		t.Errorf("Failed to make a new Mounter: %v", err) | ||||
| 	} | ||||
|   | ||||
| @@ -296,7 +296,7 @@ func (plugin *FakeVolumePlugin) SupportsSELinuxContextMount(spec *volume.Spec) ( | ||||
| 	return plugin.SupportsSELinux, nil | ||||
| } | ||||
|  | ||||
| func (plugin *FakeVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *FakeVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	plugin.Lock() | ||||
| 	defer plugin.Unlock() | ||||
| 	if spec.Name() == FailNewMounter { | ||||
| @@ -338,7 +338,7 @@ func (plugin *FakeVolumePlugin) GetUnmounters() (Unmounters []*FakeVolume) { | ||||
| } | ||||
|  | ||||
| // Block volume support | ||||
| func (plugin *FakeVolumePlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.BlockVolumeMapper, error) { | ||||
| func (plugin *FakeVolumePlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod) (volume.BlockVolumeMapper, error) { | ||||
| 	plugin.Lock() | ||||
| 	defer plugin.Unlock() | ||||
| 	volume := plugin.getFakeVolume(&plugin.BlockVolumeMappers) | ||||
| @@ -555,8 +555,8 @@ func (f *FakeBasicVolumePlugin) Init(ost volume.VolumeHost) error { | ||||
| 	return f.Plugin.Init(ost) | ||||
| } | ||||
|  | ||||
| func (f *FakeBasicVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| 	return f.Plugin.NewMounter(spec, pod, opts) | ||||
| func (f *FakeBasicVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod) (volume.Mounter, error) { | ||||
| 	return f.Plugin.NewMounter(spec, pod) | ||||
| } | ||||
|  | ||||
| func (f *FakeBasicVolumePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { | ||||
| @@ -652,7 +652,7 @@ func (plugin *FakeFileVolumePlugin) SupportsSELinuxContextMount(spec *volume.Spe | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (plugin *FakeFileVolumePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { | ||||
| func (plugin *FakeFileVolumePlugin) NewMounter(spec *volume.Spec, podRef *v1.Pod) (volume.Mounter, error) { | ||||
| 	return nil, nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -152,7 +152,7 @@ func (f *fakeVolumeHost) GetAttachedVolumesFromNodeStatus() (map[v1.UniqueVolume | ||||
| 	return map[v1.UniqueVolumeName]string{}, nil | ||||
| } | ||||
|  | ||||
| func (f *fakeVolumeHost) NewWrapperMounter(volName string, spec Spec, pod *v1.Pod, opts VolumeOptions) (Mounter, error) { | ||||
| func (f *fakeVolumeHost) NewWrapperMounter(volName string, spec Spec, pod *v1.Pod) (Mounter, error) { | ||||
| 	// The name of wrapper volume is set to "wrapped_{wrapped_volume_name}" | ||||
| 	wrapperVolumeName := "wrapped_" + volName | ||||
| 	if spec.Volume != nil { | ||||
| @@ -162,7 +162,7 @@ func (f *fakeVolumeHost) NewWrapperMounter(volName string, spec Spec, pod *v1.Po | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return plug.NewMounter(&spec, pod, opts) | ||||
| 	return plug.NewMounter(&spec, pod) | ||||
| } | ||||
|  | ||||
| func (f *fakeVolumeHost) NewWrapperUnmounter(volName string, spec Spec, podUID types.UID) (Unmounter, error) { | ||||
|   | ||||
| @@ -483,8 +483,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc( | ||||
|  | ||||
| 		volumeMounter, newMounterErr := volumePlugin.NewMounter( | ||||
| 			volumeToMount.VolumeSpec, | ||||
| 			volumeToMount.Pod, | ||||
| 			volume.VolumeOptions{}) | ||||
| 			volumeToMount.Pod) | ||||
| 		if newMounterErr != nil { | ||||
| 			eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.NewMounter initialization failed", newMounterErr) | ||||
| 			return volumetypes.NewOperationContext(eventErr, detailedErr, migrated) | ||||
| @@ -970,8 +969,7 @@ func (og *operationGenerator) GenerateMapVolumeFunc( | ||||
| 	} | ||||
| 	blockVolumeMapper, newMapperErr := blockVolumePlugin.NewBlockVolumeMapper( | ||||
| 		volumeToMount.VolumeSpec, | ||||
| 		volumeToMount.Pod, | ||||
| 		volume.VolumeOptions{}) | ||||
| 		volumeToMount.Pod) | ||||
| 	if newMapperErr != nil { | ||||
| 		eventErr, detailedErr := volumeToMount.GenerateError("MapVolume.NewBlockVolumeMapper initialization failed", newMapperErr) | ||||
| 		og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeWarning, kevents.FailedMapVolume, eventErr.Error()) | ||||
| @@ -1877,8 +1875,7 @@ func (og *operationGenerator) GenerateExpandInUseVolumeFunc( | ||||
| 		if fsVolume { | ||||
| 			volumeMounter, newMounterErr := volumePlugin.NewMounter( | ||||
| 				volumeToMount.VolumeSpec, | ||||
| 				volumeToMount.Pod, | ||||
| 				volume.VolumeOptions{}) | ||||
| 				volumeToMount.Pod) | ||||
| 			if newMounterErr != nil { | ||||
| 				eventErr, detailedErr = volumeToMount.GenerateError("NodeExpandVolume.NewMounter initialization failed", newMounterErr) | ||||
| 				return volumetypes.NewOperationContext(eventErr, detailedErr, migrated) | ||||
| @@ -1916,8 +1913,7 @@ func (og *operationGenerator) GenerateExpandInUseVolumeFunc( | ||||
|  | ||||
| 			blockVolumeMapper, newMapperErr := blockVolumePlugin.NewBlockVolumeMapper( | ||||
| 				volumeToMount.VolumeSpec, | ||||
| 				volumeToMount.Pod, | ||||
| 				volume.VolumeOptions{}) | ||||
| 				volumeToMount.Pod) | ||||
| 			if newMapperErr != nil { | ||||
| 				eventErr, detailedErr = volumeToMount.GenerateError("MapVolume.NewBlockVolumeMapper initialization failed", newMapperErr) | ||||
| 				return volumetypes.NewOperationContext(eventErr, detailedErr, migrated) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 carlory
					carlory