mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Move readinessManager updates handling to kubelet
This commit is contained in:
@@ -373,27 +373,18 @@ var _ = SIGDescribe("Probing container", func() {
|
||||
Testname: Pod readiness probe, delayed by startup probe
|
||||
Description: A Pod is created with startup and readiness probes. The Container is started by creating /tmp/startup after 45 seconds, delaying the ready state by this amount of time. This is similar to the "Pod readiness probe, with initial delay" test.
|
||||
*/
|
||||
ginkgo.It("should not be ready until startupProbe succeeds", func() {
|
||||
ginkgo.It("should be ready immediately after startupProbe succeeds", func() {
|
||||
sleepBeforeStarted := time.Duration(45)
|
||||
cmd := []string{"/bin/sh", "-c", fmt.Sprintf("echo ok >/tmp/health; sleep %d; echo ok >/tmp/startup; sleep 600", sleepBeforeStarted)}
|
||||
cmd := []string{"/bin/sh", "-c", fmt.Sprintf("sleep %d; echo ok >/tmp/startup; sleep 600", sleepBeforeStarted)}
|
||||
readinessProbe := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{"cat", "/tmp/health"},
|
||||
},
|
||||
},
|
||||
Handler: execHandler([]string{"/bin/true"}),
|
||||
InitialDelaySeconds: 0,
|
||||
PeriodSeconds: 60,
|
||||
}
|
||||
startupProbe := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{"cat", "/tmp/startup"},
|
||||
},
|
||||
},
|
||||
Handler: execHandler([]string{"/bin/cat", "/tmp/startup"}),
|
||||
InitialDelaySeconds: 0,
|
||||
PeriodSeconds: 1,
|
||||
FailureThreshold: 600,
|
||||
FailureThreshold: 60,
|
||||
}
|
||||
p := podClient.Create(startupPodSpec(startupProbe, readinessProbe, nil, cmd))
|
||||
|
||||
@@ -416,12 +407,13 @@ var _ = SIGDescribe("Probing container", func() {
|
||||
startedTime, err := GetContainerStartedTime(p, "busybox")
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
framework.Logf("Container started at %v, pod became ready at %v", startedTime, readyTime)
|
||||
if readyTime.Sub(startedTime) < sleepBeforeStarted*time.Second {
|
||||
readyIn := readyTime.Sub(startedTime) - sleepBeforeStarted*time.Second
|
||||
framework.Logf("Container started at %v, pod became ready at %v, %v after startupProbe succeeded", startedTime, readyTime, readyIn)
|
||||
if readyIn < 0 {
|
||||
framework.Failf("Pod became ready before startupProbe succeeded")
|
||||
}
|
||||
if readyTime.Sub(startedTime) > (sleepBeforeStarted+20)*time.Second {
|
||||
framework.Failf("Pod became ready more than 20s after startupProbe succeeded")
|
||||
if readyIn > 5*time.Second {
|
||||
framework.Failf("Pod became ready in %v, more than 5s after startupProbe succeeded. It means that the delay readiness probes were not initiated immediately after startup finished.", readyIn)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user