From 447e55132a450f202004f5b058d9b5e3d2efb563 Mon Sep 17 00:00:00 2001 From: houjun Date: Fri, 7 May 2021 22:44:41 +0800 Subject: [PATCH] Delete duplicate judgments --- pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go index cbfa7c320f7..1b89efa389a 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi.go @@ -284,7 +284,7 @@ func (pl *nonCSILimits) filterVolumes(volumes []v1.Volume, namespace string, fil pvID := fmt.Sprintf("%s-%s/%s", pl.randomVolumeIDPrefix, namespace, pvcName) pvc, err := pl.pvcLister.PersistentVolumeClaims(namespace).Get(pvcName) - if err != nil || pvc == nil { + if err != nil { // If the PVC is invalid, we don't count the volume because // there's no guarantee that it belongs to the running predicate. klog.V(4).InfoS("Unable to look up PVC info, assuming PVC doesn't match predicate when counting limits", "PVC", fmt.Sprintf("%s/%s", namespace, pvcName), "err", err) @@ -305,7 +305,7 @@ func (pl *nonCSILimits) filterVolumes(volumes []v1.Volume, namespace string, fil } pv, err := pl.pvLister.Get(pvName) - if err != nil || pv == nil { + if err != nil { // If the PV is invalid and PVC belongs to the running predicate, // log the error and count the PV towards the PV limit. if pl.matchProvisioner(pvc) {