mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #101738 from matthyx/deflake-startupprobe
fix manual trigger of readinessProbe on startupProbe success
This commit is contained in:
commit
9f7c9c322f
@ -241,8 +241,8 @@ func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
|
||||
var ready bool
|
||||
if c.State.Running == nil {
|
||||
ready = false
|
||||
} else if result, ok := m.readinessManager.Get(kubecontainer.ParseContainerID(c.ContainerID)); ok {
|
||||
ready = result == results.Success
|
||||
} else if result, ok := m.readinessManager.Get(kubecontainer.ParseContainerID(c.ContainerID)); ok && result == results.Success {
|
||||
ready = true
|
||||
} else {
|
||||
// The check whether there is a probe which hasn't run yet.
|
||||
w, exists := m.getWorker(podUID, c.Name, readiness)
|
||||
|
@ -398,11 +398,14 @@ var _ = SIGDescribe("Probing container", func() {
|
||||
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 be ready immediately after startupProbe succeeds", func() {
|
||||
cmd := []string{"/bin/sh", "-c", "echo ok >/tmp/health; sleep 10; echo ok >/tmp/startup; sleep 600"}
|
||||
// Probe workers sleep at Kubelet start for a random time which is at most PeriodSeconds
|
||||
// this test requires both readiness and startup workers running before updating statuses
|
||||
// to avoid flakes, ensure sleep before startup (22s) > readinessProbe.PeriodSeconds
|
||||
cmd := []string{"/bin/sh", "-c", "echo ok >/tmp/health; sleep 22; echo ok >/tmp/startup; sleep 600"}
|
||||
readinessProbe := &v1.Probe{
|
||||
Handler: execHandler([]string{"/bin/cat", "/tmp/health"}),
|
||||
InitialDelaySeconds: 0,
|
||||
PeriodSeconds: 60,
|
||||
PeriodSeconds: 20,
|
||||
}
|
||||
startupProbe := &v1.Probe{
|
||||
Handler: execHandler([]string{"/bin/cat", "/tmp/startup"}),
|
||||
|
Loading…
Reference in New Issue
Block a user