@@ -372,6 +372,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
372
372
evictSystemCriticalPods bool
373
373
priorityThreshold * int32
374
374
nodeFit bool
375
+ minReplicas uint
375
376
result bool
376
377
}
377
378
@@ -527,7 +528,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
527
528
evictSystemCriticalPods : false ,
528
529
result : true ,
529
530
}, {
530
- description : "Pod not evicted becasuse it is part of a daemonSet" ,
531
+ description : "Pod not evicted because it is part of a daemonSet" ,
531
532
pods : []* v1.Pod {
532
533
test .BuildTestPod ("p8" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
533
534
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -538,7 +539,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
538
539
evictSystemCriticalPods : false ,
539
540
result : false ,
540
541
}, {
541
- description : "Pod is evicted becasuse it is part of a daemonSet, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
542
+ description : "Pod is evicted because it is part of a daemonSet, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
542
543
pods : []* v1.Pod {
543
544
test .BuildTestPod ("p9" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
544
545
pod .Annotations = map [string ]string {"descheduler.alpha.kubernetes.io/evict" : "true" }
@@ -549,7 +550,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
549
550
evictSystemCriticalPods : false ,
550
551
result : true ,
551
552
}, {
552
- description : "Pod not evicted becasuse it is a mirror poddsa" ,
553
+ description : "Pod not evicted because it is a mirror poddsa" ,
553
554
pods : []* v1.Pod {
554
555
test .BuildTestPod ("p10" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
555
556
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -560,7 +561,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
560
561
evictSystemCriticalPods : false ,
561
562
result : false ,
562
563
}, {
563
- description : "Pod is evicted becasuse it is a mirror pod, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
564
+ description : "Pod is evicted because it is a mirror pod, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
564
565
pods : []* v1.Pod {
565
566
test .BuildTestPod ("p11" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
566
567
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -572,7 +573,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
572
573
evictSystemCriticalPods : false ,
573
574
result : true ,
574
575
}, {
575
- description : "Pod not evicted becasuse it has system critical priority" ,
576
+ description : "Pod not evicted because it has system critical priority" ,
576
577
pods : []* v1.Pod {
577
578
test .BuildTestPod ("p12" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
578
579
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -584,7 +585,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
584
585
evictSystemCriticalPods : false ,
585
586
result : false ,
586
587
}, {
587
- description : "Pod is evicted becasuse it has system critical priority, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
588
+ description : "Pod is evicted because it has system critical priority, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
588
589
pods : []* v1.Pod {
589
590
test .BuildTestPod ("p13" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
590
591
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -599,7 +600,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
599
600
evictSystemCriticalPods : false ,
600
601
result : true ,
601
602
}, {
602
- description : "Pod not evicted becasuse it has a priority higher than the configured priority threshold" ,
603
+ description : "Pod not evicted because it has a priority higher than the configured priority threshold" ,
603
604
pods : []* v1.Pod {
604
605
test .BuildTestPod ("p14" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
605
606
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -611,7 +612,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
611
612
priorityThreshold : & lowPriority ,
612
613
result : false ,
613
614
}, {
614
- description : "Pod is evicted becasuse it has a priority higher than the configured priority threshold, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
615
+ description : "Pod is evicted because it has a priority higher than the configured priority threshold, but it has scheduler.alpha.kubernetes.io/evict annotation" ,
615
616
pods : []* v1.Pod {
616
617
test .BuildTestPod ("p15" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
617
618
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -624,7 +625,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
624
625
priorityThreshold : & lowPriority ,
625
626
result : true ,
626
627
}, {
627
- description : "Pod is evicted becasuse it has system critical priority, but evictSystemCriticalPods = true" ,
628
+ description : "Pod is evicted because it has system critical priority, but evictSystemCriticalPods = true" ,
628
629
pods : []* v1.Pod {
629
630
test .BuildTestPod ("p16" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
630
631
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -636,7 +637,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
636
637
evictSystemCriticalPods : true ,
637
638
result : true ,
638
639
}, {
639
- description : "Pod is evicted becasuse it has system critical priority, but evictSystemCriticalPods = true and it has scheduler.alpha.kubernetes.io/evict annotation" ,
640
+ description : "Pod is evicted because it has system critical priority, but evictSystemCriticalPods = true and it has scheduler.alpha.kubernetes.io/evict annotation" ,
640
641
pods : []* v1.Pod {
641
642
test .BuildTestPod ("p16" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
642
643
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -649,7 +650,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
649
650
evictSystemCriticalPods : true ,
650
651
result : true ,
651
652
}, {
652
- description : "Pod is evicted becasuse it has a priority higher than the configured priority threshold, but evictSystemCriticalPods = true" ,
653
+ description : "Pod is evicted because it has a priority higher than the configured priority threshold, but evictSystemCriticalPods = true" ,
653
654
pods : []* v1.Pod {
654
655
test .BuildTestPod ("p17" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
655
656
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -661,7 +662,7 @@ func TestDefaultEvictorFilter(t *testing.T) {
661
662
priorityThreshold : & lowPriority ,
662
663
result : true ,
663
664
}, {
664
- description : "Pod is evicted becasuse it has a priority higher than the configured priority threshold, but evictSystemCriticalPods = true and it has scheduler.alpha.kubernetes.io/evict annotation" ,
665
+ description : "Pod is evicted because it has a priority higher than the configured priority threshold, but evictSystemCriticalPods = true and it has scheduler.alpha.kubernetes.io/evict annotation" ,
665
666
pods : []* v1.Pod {
666
667
test .BuildTestPod ("p17" , 400 , 0 , n1 .Name , func (pod * v1.Pod ) {
667
668
pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
@@ -704,6 +705,30 @@ func TestDefaultEvictorFilter(t *testing.T) {
704
705
evictSystemCriticalPods : false ,
705
706
nodeFit : true ,
706
707
result : true ,
708
+ }, {
709
+ description : "minReplicas of 2, owner with 2 replicas, evicts" ,
710
+ pods : []* v1.Pod {
711
+ test .BuildTestPod ("p1" , 1 , 1 , n1 .Name , func (pod * v1.Pod ) {
712
+ pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
713
+ }),
714
+ test .BuildTestPod ("p2" , 1 , 1 , n1 .Name , func (pod * v1.Pod ) {
715
+ pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
716
+ }),
717
+ },
718
+ minReplicas : 2 ,
719
+ result : true ,
720
+ }, {
721
+ description : "minReplicas of 3, owner with 2 replicas, no eviction" ,
722
+ pods : []* v1.Pod {
723
+ test .BuildTestPod ("p1" , 1 , 1 , n1 .Name , func (pod * v1.Pod ) {
724
+ pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
725
+ }),
726
+ test .BuildTestPod ("p2" , 1 , 1 , n1 .Name , func (pod * v1.Pod ) {
727
+ pod .ObjectMeta .OwnerReferences = test .GetNormalPodOwnerRefList ()
728
+ }),
729
+ },
730
+ minReplicas : 3 ,
731
+ result : false ,
707
732
},
708
733
}
709
734
@@ -741,7 +766,8 @@ func TestDefaultEvictorFilter(t *testing.T) {
741
766
PriorityThreshold : & api.PriorityThreshold {
742
767
Value : test .priorityThreshold ,
743
768
},
744
- NodeFit : test .nodeFit ,
769
+ NodeFit : test .nodeFit ,
770
+ MinReplicas : test .minReplicas ,
745
771
}
746
772
747
773
evictorPlugin , err := New (
0 commit comments