Skip sorting if all pods will be deleted
This commit is contained in:
@@ -318,10 +318,13 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, controller
|
|||||||
}
|
}
|
||||||
rm.expectations.ExpectDeletions(controller, diff)
|
rm.expectations.ExpectDeletions(controller, diff)
|
||||||
glog.V(2).Infof("Too many %q/%q replicas, need %d, deleting %d", controller.Namespace, controller.Name, controller.Spec.Replicas, diff)
|
glog.V(2).Infof("Too many %q/%q replicas, need %d, deleting %d", controller.Namespace, controller.Name, controller.Spec.Replicas, diff)
|
||||||
// Sort the pods in the order such that not-ready < ready, unscheduled
|
// No need to sort pods if we are about to delete all of them
|
||||||
// < scheduled, and pending < running. This ensures that we delete pods
|
if controller.Spec.Replicas != 0 {
|
||||||
// in the earlier stages whenever possible.
|
// Sort the pods in the order such that not-ready < ready, unscheduled
|
||||||
sort.Sort(activePods(filteredPods))
|
// < scheduled, and pending < running. This ensures that we delete pods
|
||||||
|
// in the earlier stages whenever possible.
|
||||||
|
sort.Sort(activePods(filteredPods))
|
||||||
|
}
|
||||||
|
|
||||||
wait := sync.WaitGroup{}
|
wait := sync.WaitGroup{}
|
||||||
wait.Add(diff)
|
wait.Add(diff)
|
||||||
|
Reference in New Issue
Block a user