mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #4421 from brendandburns/docs
Add some retry to envvar log gathering.
This commit is contained in:
commit
200ef91ffc
@ -323,16 +323,24 @@ var _ = Describe("Pods", func() {
|
|||||||
}
|
}
|
||||||
By(fmt.Sprintf("Trying to get logs from host %s pod %s container %s: %v",
|
By(fmt.Sprintf("Trying to get logs from host %s pod %s container %s: %v",
|
||||||
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
|
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
|
||||||
logs, err := c.Get().
|
var logs []byte
|
||||||
Prefix("proxy").
|
start := time.Now()
|
||||||
Resource("minions").
|
// Sometimes the actual containers take a second to get started, try to get logs for 60s
|
||||||
Name(clientPodStatus.Status.Host).
|
for time.Now().Sub(start) < (60 * time.Second) {
|
||||||
Suffix("containerLogs", api.NamespaceDefault, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name).
|
logs, err = c.Get().
|
||||||
Do().
|
Prefix("proxy").
|
||||||
Raw()
|
Resource("minions").
|
||||||
if err != nil {
|
Name(clientPodStatus.Status.Host).
|
||||||
Fail(fmt.Sprintf("Failed to get logs from host %s pod %s container %s: %v",
|
Suffix("containerLogs", api.NamespaceDefault, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name).
|
||||||
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
|
Do().
|
||||||
|
Raw()
|
||||||
|
if err != nil {
|
||||||
|
By(fmt.Sprintf("Failed to get logs from host %s pod %s container %s: %v",
|
||||||
|
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
fmt.Sprintf("clientPod logs:%v\n", string(logs))
|
fmt.Sprintf("clientPod logs:%v\n", string(logs))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user