From 568e58044252e9078639b095ff6ddf8ab09da531 Mon Sep 17 00:00:00 2001 From: carlory Date: Mon, 13 May 2024 11:04:17 +0800 Subject: [PATCH] remove unused FindCreatablePluginBySpec --- pkg/volume/hostpath/host_path_test.go | 4 +--- pkg/volume/local/local_test.go | 5 ----- pkg/volume/plugins.go | 13 ------------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/pkg/volume/hostpath/host_path_test.go b/pkg/volume/hostpath/host_path_test.go index ec218977900..6f9fc42c42e 100644 --- a/pkg/volume/hostpath/host_path_test.go +++ b/pkg/volume/hostpath/host_path_test.go @@ -159,9 +159,7 @@ func TestProvisioner(t *testing.T) { plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}), nil, volumetest.NewFakeKubeletVolumeHost(t, "/tmp/fake", nil, nil)) - spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: fmt.Sprintf("/tmp/hostpath.%s", uuid.NewUUID())}}}}} - plug, err := plugMgr.FindCreatablePluginBySpec(spec) + plug, err := plugMgr.FindProvisionablePluginByName(hostPathPluginName) if err != nil { t.Fatalf("Can't find the plugin by name") } diff --git a/pkg/volume/local/local_test.go b/pkg/volume/local/local_test.go index 8d549ae7c15..f24d1ac6271 100644 --- a/pkg/volume/local/local_test.go +++ b/pkg/volume/local/local_test.go @@ -720,11 +720,6 @@ func TestUnsupportedPlugins(t *testing.T) { t.Errorf("Attachable plugin found, expected none") } - createPlug, err := plugMgr.FindCreatablePluginBySpec(spec) - if err == nil && createPlug != nil { - t.Errorf("Creatable plugin found, expected none") - } - provisionPlug, err := plugMgr.FindProvisionablePluginByName(localVolumePluginName) if err == nil && provisionPlug != nil { t.Errorf("Provisionable plugin found, expected none") diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 399ca814c26..19fc00a114c 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -798,19 +798,6 @@ func (pm *VolumePluginMgr) FindDeletablePluginByName(name string) (DeletableVolu return nil, fmt.Errorf("no deletable volume plugin matched") } -// FindCreatablePluginBySpec fetches a persistent volume plugin by name. If -// no plugin is found, returns error. -func (pm *VolumePluginMgr) FindCreatablePluginBySpec(spec *Spec) (ProvisionableVolumePlugin, error) { - volumePlugin, err := pm.FindPluginBySpec(spec) - if err != nil { - return nil, err - } - if provisionableVolumePlugin, ok := volumePlugin.(ProvisionableVolumePlugin); ok { - return provisionableVolumePlugin, nil - } - return nil, fmt.Errorf("no creatable volume plugin matched") -} - // FindAttachablePluginBySpec fetches a persistent volume plugin by spec. // Unlike the other "FindPlugin" methods, this does not return error if no // plugin is found. All volumes require a mounter and unmounter, but not