Skip to content

Commit 9b9ae9a

Browse files
authored
Merge pull request #1650 from ingvagabund/nodeutilization-deviation-skip-nodes-without-extended-resource
[nodeutilization]: skip nodes without extended resource when computing the average utilization
2 parents 9ba0f9b + c22d773 commit 9b9ae9a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

pkg/framework/plugins/nodeutilization/lownodeutilization_test.go

+54
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,60 @@ func TestLowNodeUtilization(t *testing.T) {
716716
expectedPodsEvicted: 0,
717717
expectedPodsWithMetricsEvicted: 0,
718718
},
719+
{
720+
name: "with extended resource in some of nodes with deviation",
721+
thresholds: api.ResourceThresholds{
722+
v1.ResourcePods: 5,
723+
extendedResource: 10,
724+
},
725+
targetThresholds: api.ResourceThresholds{
726+
v1.ResourcePods: 5,
727+
extendedResource: 10,
728+
},
729+
useDeviationThresholds: true,
730+
nodes: []*v1.Node{
731+
test.BuildTestNode(n1NodeName, 4000, 3000, 10, func(node *v1.Node) {
732+
test.SetNodeExtendedResource(node, extendedResource, 8)
733+
}),
734+
test.BuildTestNode(n2NodeName, 4000, 3000, 10, func(node *v1.Node) {
735+
test.SetNodeExtendedResource(node, extendedResource, 8)
736+
}),
737+
test.BuildTestNode(n3NodeName, 4000, 3000, 10, test.SetNodeUnschedulable),
738+
},
739+
pods: []*v1.Pod{
740+
test.BuildTestPod("p1", 0, 0, n1NodeName, func(pod *v1.Pod) {
741+
// A pod with extended resource.
742+
test.SetRSOwnerRef(pod)
743+
test.SetPodExtendedResourceRequest(pod, extendedResource, 1)
744+
}),
745+
test.BuildTestPod("p2", 0, 0, n2NodeName, func(pod *v1.Pod) {
746+
// A pod with extended resource.
747+
test.SetRSOwnerRef(pod)
748+
test.SetPodExtendedResourceRequest(pod, extendedResource, 7)
749+
}),
750+
test.BuildTestPod("p3", 0, 0, n2NodeName, func(pod *v1.Pod) {
751+
test.SetRSOwnerRef(pod)
752+
}),
753+
test.BuildTestPod("p8", 0, 0, n3NodeName, func(pod *v1.Pod) {
754+
test.SetRSOwnerRef(pod)
755+
}),
756+
test.BuildTestPod("p9", 0, 0, n3NodeName, test.SetRSOwnerRef),
757+
},
758+
nodemetricses: []*v1beta1.NodeMetrics{
759+
test.BuildNodeMetrics(n1NodeName, 3201, 0),
760+
test.BuildNodeMetrics(n2NodeName, 401, 0),
761+
test.BuildNodeMetrics(n3NodeName, 11, 0),
762+
},
763+
podmetricses: []*v1beta1.PodMetrics{
764+
test.BuildPodMetrics("p1", 401, 0),
765+
test.BuildPodMetrics("p2", 401, 0),
766+
test.BuildPodMetrics("p3", 401, 0),
767+
test.BuildPodMetrics("p4", 401, 0),
768+
test.BuildPodMetrics("p5", 401, 0),
769+
},
770+
expectedPodsEvicted: 1,
771+
expectedPodsWithMetricsEvicted: 0,
772+
},
719773
{
720774
name: "without priorities, but only other node is unschedulable",
721775
thresholds: api.ResourceThresholds{

0 commit comments

Comments
 (0)