Skip to content

Commit

Permalink
Merge pull request #101226 from wzshiming/automated-cherry-pick-of-#1…
Browse files Browse the repository at this point in the history
…01093-upstream-release-1.18

Automated cherry pick of #101093: Fix `startupProbe` behaviour changed
  • Loading branch information
k8s-ci-robot committed Apr 28, 2021
2 parents 461c190 + 0d15405 commit 84fe7b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 2 additions & 1 deletion pkg/kubelet/prober/worker.go
Expand Up @@ -243,8 +243,9 @@ func (w *worker) doProbe() (keepGoing bool) {

if c.Started != nil && *c.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 {
return false
return true
}
} else {
// Disable other probes until container has started.
Expand Down
8 changes: 1 addition & 7 deletions pkg/kubelet/prober/worker_test.go
Expand Up @@ -335,12 +335,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 {
switch probeType {
case readiness:
Expand Down Expand Up @@ -510,6 +504,6 @@ func TestStartupProbeDisabledByStarted(t *testing.T) {
// startupProbe fails, but is disabled
m.prober.exec = fakeExecProber{probe.Failure, nil}
msg = "Started, probe failure, result success"
expectStop(t, w, w.doProbe(), msg)
expectContinue(t, w, w.doProbe(), msg)
expectResult(t, w, results.Success, msg)
}

0 comments on commit 84fe7b4

Please sign in to comment.