mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Fixed flakiness of e2e reboot test.
Fixed flakiness of e2e reboot test caused by restarts of pods with liviness probe during node reboot. Fixes #9062.
This commit is contained in:
parent
835eded294
commit
b4585a7883
@ -171,11 +171,21 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string, result chan
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all the pods on the node.
|
// Get all the pods on the node that don't have liveness probe set.
|
||||||
|
// Liveness probe may cause restart of a pod during node reboot, and the pod may not be running.
|
||||||
pods := ps.List()
|
pods := ps.List()
|
||||||
podNames := make([]string, len(pods))
|
podNames := []string{}
|
||||||
for i, p := range pods {
|
for _, p := range pods {
|
||||||
podNames[i] = p.ObjectMeta.Name
|
probe := false
|
||||||
|
for _, c := range p.Spec.Containers {
|
||||||
|
if c.LivenessProbe != nil {
|
||||||
|
probe = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !probe {
|
||||||
|
podNames = append(podNames, p.ObjectMeta.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Logf("Node %s has %d pods: %v", name, len(podNames), podNames)
|
Logf("Node %s has %d pods: %v", name, len(podNames), podNames)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user