Remove redundant checks

This commit is contained in:
houjun 2021-04-21 09:55:45 +08:00
parent 6a7572e4ad
commit d3a355d6dc

View File

@ -116,10 +116,6 @@ func (pl *VolumeZone) Filter(ctx context.Context, _ *framework.CycleState, pod *
return framework.AsStatus(err) return framework.AsStatus(err)
} }
if pvc == nil {
return framework.NewStatus(framework.Error, fmt.Sprintf("PersistentVolumeClaim was not found: %q", pvcName))
}
pvName := pvc.Spec.VolumeName pvName := pvc.Spec.VolumeName
if pvName == "" { if pvName == "" {
scName := storagehelpers.GetPersistentVolumeClaimClass(pvc) scName := storagehelpers.GetPersistentVolumeClaimClass(pvc)
@ -148,10 +144,6 @@ func (pl *VolumeZone) Filter(ctx context.Context, _ *framework.CycleState, pod *
return framework.AsStatus(err) return framework.AsStatus(err)
} }
if pv == nil {
return framework.NewStatus(framework.Error, fmt.Sprintf("PersistentVolume was not found: %q", pvName))
}
for k, v := range pv.ObjectMeta.Labels { for k, v := range pv.ObjectMeta.Labels {
if !volumeZoneLabels.Has(k) { if !volumeZoneLabels.Has(k) {
continue continue