mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #101093 from wzshiming/fix/startup-probe
Fix `startupProbe` behaviour changed
This commit is contained in:
commit
7552ca9f56
@ -250,8 +250,9 @@ func (w *worker) doProbe() (keepGoing bool) {
|
|||||||
|
|
||||||
if c.Started != nil && *c.Started {
|
if c.Started != nil && *c.Started {
|
||||||
// Stop probing for startup once container has started.
|
// Stop probing for startup once container has started.
|
||||||
|
// we keep it running to make sure it will work for restarted container.
|
||||||
if w.probeType == startup {
|
if w.probeType == startup {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Disable other probes until container has started.
|
// Disable other probes until container has started.
|
||||||
|
@ -333,12 +333,6 @@ func expectContinue(t *testing.T, w *worker, c bool, msg string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func expectStop(t *testing.T, w *worker, c bool, msg string) {
|
|
||||||
if c {
|
|
||||||
t.Errorf("[%s - %s] Expected to stop, but did not", w.probeType, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func resultsManager(m *manager, probeType probeType) results.Manager {
|
func resultsManager(m *manager, probeType probeType) results.Manager {
|
||||||
switch probeType {
|
switch probeType {
|
||||||
case readiness:
|
case readiness:
|
||||||
@ -508,6 +502,6 @@ func TestStartupProbeDisabledByStarted(t *testing.T) {
|
|||||||
// startupProbe fails, but is disabled
|
// startupProbe fails, but is disabled
|
||||||
m.prober.exec = fakeExecProber{probe.Failure, nil}
|
m.prober.exec = fakeExecProber{probe.Failure, nil}
|
||||||
msg = "Started, probe failure, result success"
|
msg = "Started, probe failure, result success"
|
||||||
expectStop(t, w, w.doProbe(), msg)
|
expectContinue(t, w, w.doProbe(), msg)
|
||||||
expectResult(t, w, results.Success, msg)
|
expectResult(t, w, results.Success, msg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user