Merge pull request #124317 from hoyho/bugfix/expand_vol_warning

fix warning when using CSI driver to expand volume
This commit is contained in:
Kubernetes Prow Robot 2024-09-18 16:02:44 +01:00 committed by GitHub
commit 24a447e38f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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