Merge pull request #114897 from kidddddddddddddddddddddd/volumebinding

feature(volumebinding): return Skip in PreFilter
This commit is contained in:
Kubernetes Prow Robot 2023-01-16 23:38:32 -08:00 committed by GitHub
commit f16e62ae0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 10 deletions

View File

@ -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 {

View File

@ -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,
},