hasAnyNodeConstraint

This commit is contained in:
kidddddddddddddddddddddd 2023-01-13 15:00:25 +08:00
parent eabb70833a
commit 2ba4c00b3c
2 changed files with 16 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
@ -209,8 +210,8 @@ func (pl *VolumeZone) Filter(ctx context.Context, cs *framework.CycleState, pod
node := nodeInfo.Node()
hasAnyNodeConstraint := false
for _, pvTopology := range podPVTopologies {
if _, ok := node.Labels[pvTopology.key]; ok {
for _, topologyLabel := range topologyLabels {
if _, ok := node.Labels[topologyLabel]; ok {
hasAnyNodeConstraint = true
break
}

View File

@ -215,6 +215,19 @@ func TestSingleZone(t *testing.T) {
},
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
},
{
name: "pv with zone,node with beta zone",
Pod: createPodWithVolume("pod_1", "Vol_Stable_1", "PVC_Stable_1"),
Node: &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "host1",
Labels: map[string]string{
v1.LabelFailureDomainBetaZone: "us-west1-a",
},
},
},
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
},
}
for _, test := range tests {