diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 4152bffb43b..1e6c36f638d 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -17,6 +17,7 @@ limitations under the License. package volume import ( + "errors" "fmt" "net" "strings" @@ -62,6 +63,8 @@ const ( ProbeRemove ) +var ErrNoPluiginMatched = errors.New("no volume plugin matched") + // VolumeOptions contains option information about a volume. type VolumeOptions struct { // The attributes below are required by volume.Provisioner @@ -649,7 +652,7 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) { } if len(matchedPluginNames) == 0 { - return nil, fmt.Errorf("no volume plugin matched") + return nil, ErrNoPluiginMatched } if len(matchedPluginNames) > 1 { return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ",")) @@ -876,6 +879,9 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol klog.V(4).InfoS("FindExpandablePluginBySpec -> returning noopExpandableVolumePluginInstance", "specName", spec.Name()) return &noopExpandableVolumePluginInstance{spec}, nil } + if errors.Is(err, ErrNoPluiginMatched) { + return nil, nil + } klog.V(4).InfoS("FindExpandablePluginBySpec -> err", "specName", spec.Name(), "err", err) return nil, err }