mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #115052 from kidddddddddddddddddddddd/fix/volume_zone
fix volume_zone, iterate all topologyLabels when check node
This commit is contained in:
commit
98da10e4f2
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user