Prioritize deleting the non-running pods when reducing replicas

This changes instructs the replication controller to delete replicas in the
order of "unscheduled (pending)", "scheduled (pending)", and "scheduled
(running)" pods. This is less disruptive than deleting random pods.
This commit is contained in:
Yu-Ju Hong
2015-04-16 17:37:57 -07:00
parent b944049fe9
commit df2cbd4877
4 changed files with 104 additions and 22 deletions

View File

@@ -58,3 +58,13 @@ func GetExistingContainerStatus(statuses []ContainerStatus, name string) Contain
}
return ContainerStatus{}
}
// IsPodReady retruns true if a pod is ready; false otherwise.
func IsPodReady(pod *Pod) bool {
for _, c := range pod.Status.Conditions {
if c.Type == PodReady && c.Status == ConditionTrue {
return true
}
}
return false
}