Log pods of RS when deployment e2e test fails

This commit is contained in:
Janet Kuo
2016-02-19 15:30:40 -08:00
parent 6766f11a5b
commit 6ceb221f8e
2 changed files with 39 additions and 18 deletions

View File

@@ -2128,6 +2128,7 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
}
if totalAvailable < minAvailable {
logReplicaSetsOfDeployment(deploymentName, oldRSs, newRS)
logPodsOfReplicaSets(c, allRSs, minReadySeconds)
return false, fmt.Errorf("total pods available: %d, less than the min required: %d", totalAvailable, minAvailable)
}
@@ -2170,6 +2171,19 @@ func logReplicaSetsOfDeployment(deploymentName string, oldRSs []*extensions.Repl
Logf("New ReplicaSet of deployment %s: %+v", deploymentName, newRS)
}
func logPodsOfReplicaSets(c clientset.Interface, rss []*extensions.ReplicaSet, minReadySeconds int) {
allPods, err := deploymentutil.GetPodsForReplicaSets(c, rss)
if err == nil {
for _, pod := range allPods {
availability := "not available"
if deploymentutil.IsPodAvailable(&pod, minReadySeconds) {
availability = "available"
}
Logf("Pod %s is %s: %+v", pod.Name, availability, pod)
}
}
}
// Waits for the number of events on the given object to reach a desired count.
func waitForEvents(c *client.Client, ns string, objOrRef runtime.Object, desiredEventsCount int) error {
return wait.Poll(poll, 5*time.Minute, func() (bool, error) {