report UnschedulableAndUnresolvable status instead of an error when PVCs can't find bound

persistent volumes

This is an user error. We should't report an error.
This commit is contained in:
Yecheng Fu
2020-10-14 10:47:11 +08:00
committed by Yecheng Fu
parent e54448a307
commit 0961891a7a
3 changed files with 34 additions and 8 deletions

View File

@@ -138,6 +138,22 @@ func TestVolumeBinding(t *testing.T) {
podVolumesByNode: map[string]*scheduling.PodVolumes{},
},
},
{
name: "PVC does not exist",
pod: makePod("pod-a", []string{"pvc-a"}),
node: &v1.Node{},
pvcs: []*v1.PersistentVolumeClaim{},
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, `persistentvolumeclaim "pvc-a" not found`),
},
{
name: "Part of PVCs do not exist",
pod: makePod("pod-a", []string{"pvc-a", "pvc-b"}),
node: &v1.Node{},
pvcs: []*v1.PersistentVolumeClaim{
makePVC("pvc-a", "pv-a", waitSC.Name),
},
wantPreFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, `persistentvolumeclaim "pvc-b" not found`),
},
{
name: "immediate claims not bound",
pod: makePod("pod-a", []string{"pvc-a"}),
@@ -227,7 +243,7 @@ func TestVolumeBinding(t *testing.T) {
claimsToBind: []*v1.PersistentVolumeClaim{},
podVolumesByNode: map[string]*scheduling.PodVolumes{},
},
wantFilterStatus: framework.NewStatus(framework.Error, `could not find v1.PersistentVolume "pv-a"`),
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, `pvc(s) bound to non-existent pv(s)`),
},
}