Skip to content

Commit a33653d

Browse files
fix zones match
Signed-off-by: whitewindmills <[email protected]>
1 parent 721b472 commit a33653d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/util/selector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ func matchZones(zoneMatchExpression *corev1.NodeSelectorRequirement, zones []str
218218
return false
219219
}
220220
for _, zone := range zones {
221-
if !slices.Contains(zoneMatchExpression.Values, zone) {
222-
return false
221+
if slices.Contains(zoneMatchExpression.Values, zone) {
222+
return true
223223
}
224224
}
225-
return true
225+
return false
226226
case corev1.NodeSelectorOpNotIn:
227227
for _, zone := range zones {
228228
if slices.Contains(zoneMatchExpression.Values, zone) {

pkg/util/selector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ func TestClusterMatches(t *testing.T) {
621621
},
622622
},
623623
},
624-
want: false,
624+
want: true,
625625
},
626626
{
627627
name: "test field selector region matched",
@@ -1016,7 +1016,7 @@ func Test_matchZones(t *testing.T) {
10161016
Values: []string{"foo"},
10171017
},
10181018
zones: []string{"foo", "bar"},
1019-
matched: false,
1019+
matched: true,
10201020
},
10211021
{
10221022
name: "all zones for In operator",

0 commit comments

Comments
 (0)