mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user