Report actual replicas in deployment status

This commit is contained in:
Janet Kuo
2016-02-22 14:28:28 -08:00
parent fb2a209ed7
commit 3901423272
2 changed files with 11 additions and 2 deletions

View File

@@ -177,6 +177,15 @@ func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int {
return totalReplicaCount
}
// GetActualReplicaCountForReplicaSets returns the sum of actual replicas of the given replica sets.
func GetActualReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int {
totalReplicaCount := 0
for _, rs := range replicaSets {
totalReplicaCount += rs.Status.Replicas
}
return totalReplicaCount
}
// Returns the number of available pods corresponding to the given replica sets.
func GetAvailablePodsForReplicaSets(c clientset.Interface, rss []*extensions.ReplicaSet, minReadySeconds int) (int, error) {
allPods, err := GetPodsForReplicaSets(c, rss)