controller: fix cleanup policy for deployments

Cleanup policy should run on all replica sets and not only on those that
have pods (we will not cleanup those anyway).
This commit is contained in:
Michail Kargakis
2016-02-12 16:56:44 +01:00
parent 32d844e59c
commit b9839d0677
3 changed files with 23 additions and 32 deletions

View File

@@ -432,6 +432,17 @@ func FilterActivePods(pods []api.Pod) []*api.Pod {
return result
}
// FilterActiveReplicaSets returns replica sets that have (or at least ought to have) pods.
func FilterActiveReplicaSets(replicaSets []*extensions.ReplicaSet) []*extensions.ReplicaSet {
active := []*extensions.ReplicaSet{}
for i := range replicaSets {
if replicaSets[i].Spec.Replicas > 0 {
active = append(active, replicaSets[i])
}
}
return active
}
// ControllersByCreationTimestamp sorts a list of ReplicationControllers by creation timestamp, using their names as a tie breaker.
type ControllersByCreationTimestamp []*api.ReplicationController