diff --git a/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go b/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go index 8c6da495e8d..3d251ba4a55 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go +++ b/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go @@ -47,7 +47,6 @@ const ( // framework.CycleState, in the later phases we don't need to call Write method // to update the value type stateData struct { - skip bool // set true if pod does not have PVCs allBound bool // podVolumesByNode holds the pod's volume information found in the Filter // phase for each node @@ -166,8 +165,8 @@ func (pl *VolumeBinding) PreFilter(ctx context.Context, state *framework.CycleSt if hasPVC, err := pl.podHasPVCs(pod); err != nil { return nil, framework.NewStatus(framework.UnschedulableAndUnresolvable, err.Error()) } else if !hasPVC { - state.Write(stateKey, &stateData{skip: true}) - return nil, nil + state.Write(stateKey, &stateData{}) + return nil, framework.NewStatus(framework.Skip) } podVolumeClaims, err := pl.Binder.GetPodVolumeClaims(pod) if err != nil { @@ -243,10 +242,6 @@ func (pl *VolumeBinding) Filter(ctx context.Context, cs *framework.CycleState, p return framework.AsStatus(err) } - if state.skip { - return nil - } - podVolumes, reasons, err := pl.Binder.FindPodVolumes(pod, state.podVolumeClaims, node) if err != nil { diff --git a/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go b/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go index 629bec84176..253f3da2758 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go +++ b/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go @@ -92,9 +92,7 @@ func TestVolumeBinding(t *testing.T) { nodes: []*v1.Node{ makeNode("node-a").Node, }, - wantStateAfterPreFilter: &stateData{ - skip: true, - }, + wantPreFilterStatus: framework.NewStatus(framework.Skip), wantFilterStatus: []*framework.Status{ nil, },