Skip to content

Commit 78b503d

Browse files
authored
Merge pull request kubernetes#92196 from thockin/startup-probe-blocks-readiness
Pods which have not "started" can not be "ready"
2 parents 58416f3 + 64d4254 commit 78b503d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

pkg/kubelet/prober/prober_manager.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,6 @@ func (m *manager) CleanupPods(desiredPods map[types.UID]sets.Empty) {
235235

236236
func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
237237
for i, c := range podStatus.ContainerStatuses {
238-
var ready bool
239-
if c.State.Running == nil {
240-
ready = false
241-
} else if result, ok := m.readinessManager.Get(kubecontainer.ParseContainerID(c.ContainerID)); ok {
242-
ready = result == results.Success
243-
} else {
244-
// The check whether there is a probe which hasn't run yet.
245-
_, exists := m.getWorker(podUID, c.Name, readiness)
246-
ready = !exists
247-
}
248-
podStatus.ContainerStatuses[i].Ready = ready
249-
250238
var started bool
251239
if c.State.Running == nil {
252240
started = false
@@ -261,6 +249,20 @@ func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
261249
started = !exists
262250
}
263251
podStatus.ContainerStatuses[i].Started = &started
252+
253+
if started {
254+
var ready bool
255+
if c.State.Running == nil {
256+
ready = false
257+
} else if result, ok := m.readinessManager.Get(kubecontainer.ParseContainerID(c.ContainerID)); ok {
258+
ready = result == results.Success
259+
} else {
260+
// The check whether there is a probe which hasn't run yet.
261+
_, exists := m.getWorker(podUID, c.Name, readiness)
262+
ready = !exists
263+
}
264+
podStatus.ContainerStatuses[i].Ready = ready
265+
}
264266
}
265267
// init containers are ready if they have exited with success or if a readiness probe has
266268
// succeeded.

0 commit comments

Comments
 (0)