mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 05:36:12 +00:00
Log pods of RS when deployment e2e test fails
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user