1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

skip eviction when replica count is below evictor minReplicas threshold setting

Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
This commit is contained in:
Amir Alavi
2023-10-06 23:31:39 -04:00
committed by Amir Alavi
parent ed1efe436f
commit 37df42df7c
7 changed files with 155 additions and 26 deletions

View File

@@ -107,6 +107,7 @@ func TestRemoveDuplicates(t *testing.T) {
replicasNum int
beforeFunc func(deployment *appsv1.Deployment)
expectedEvictedPodCount uint
minReplicas uint
}{
{
description: "Evict Pod even Pods schedule to specific node",
@@ -135,6 +136,15 @@ func TestRemoveDuplicates(t *testing.T) {
},
expectedEvictedPodCount: 2,
},
{
description: "Ignores eviction with minReplicas of 4",
replicasNum: 3,
beforeFunc: func(deployment *appsv1.Deployment) {
deployment.Spec.Replicas = pointer.Int32(3)
},
expectedEvictedPodCount: 0,
minReplicas: 4,
},
}
for _, tc := range tests {
t.Run(tc.description, func(t *testing.T) {
@@ -179,6 +189,7 @@ func TestRemoveDuplicates(t *testing.T) {
IgnorePvcPods: false,
EvictFailedBarePods: false,
NodeFit: false,
MinReplicas: tc.minReplicas,
}
evictorFilter, err := defaultevictor.New(