Skip to content

Commit

Permalink
Support of the namespaceLabelSelector in DefaultEvictor plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanenkoDenys committed Sep 4, 2024
1 parent 757c6df commit 056805f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion pkg/framework/plugins/defaultevictor/defaultevictor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"errors"
"fmt"
"time"
"strings"

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
16 changes: 9 additions & 7 deletions pkg/framework/plugins/defaultevictor/defaultevictor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ package defaultevictor

import (
"context"
"fmt"
"testing"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down Expand Up @@ -49,6 +51,13 @@ type testCase struct {
result bool
}

var namespace = "test"
var namespaceSelector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"kubernetes.io/metadata.name": namespace,
},
}

func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
n1 := test.BuildTestNode("node1", 1000, 2000, 13, nil)

Expand All @@ -58,13 +67,6 @@ func TestDefaultEvictorPreEvictionFilter(t *testing.T) {
nodeLabelKey := "datacenter"
nodeLabelValue := "east"

namespace := "test"
namespaceSelector := &metav1.LabelSelector{
MatchLabels: map[string]string{
"kubernetes.io/metadata.name": namespace,
},
}

testCases := []testCase{
{
description: "Pod with no tolerations running on normal node, all other nodes tainted",
Expand Down

0 comments on commit 056805f

Please sign in to comment.