mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +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"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
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()
|
node := nodeInfo.Node()
|
||||||
hasAnyNodeConstraint := false
|
hasAnyNodeConstraint := false
|
||||||
for _, pvTopology := range podPVTopologies {
|
for _, topologyLabel := range topologyLabels {
|
||||||
if _, ok := node.Labels[pvTopology.key]; ok {
|
if _, ok := node.Labels[topologyLabel]; ok {
|
||||||
hasAnyNodeConstraint = true
|
hasAnyNodeConstraint = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -215,6 +215,19 @@ func TestSingleZone(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantFilterStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
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 {
|
for _, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user