From 0abdf6abc211fda4392138207ffc6c7a5ce2da37 Mon Sep 17 00:00:00 2001 From: kidddddddddddddddddddddd <1062602710@qq.com> Date: Sat, 7 Jan 2023 22:30:16 +0800 Subject: [PATCH] revert check in filter --- pkg/scheduler/framework/plugins/volumezone/volume_zone.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/scheduler/framework/plugins/volumezone/volume_zone.go b/pkg/scheduler/framework/plugins/volumezone/volume_zone.go index c17876c9b18..e2d03865cc3 100644 --- a/pkg/scheduler/framework/plugins/volumezone/volume_zone.go +++ b/pkg/scheduler/framework/plugins/volumezone/volume_zone.go @@ -189,6 +189,11 @@ func (pl *VolumeZone) PreFilterExtensions() framework.PreFilterExtensions { // require calling out to the cloud provider. It seems that we are moving away // from inline volume declarations anyway. func (pl *VolumeZone) Filter(ctx context.Context, cs *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { + // If a pod doesn't have any volume attached to it, the predicate will always be true. + // Thus we make a fast path for it, to avoid unnecessary computations in this case. + if len(pod.Spec.Volumes) == 0 { + return nil + } var podPVTopologies []pvTopology state, err := getStateData(cs) if err != nil {