Merge pull request #92196 from thockin/startup-probe-blocks-readiness

Pods which have not "started" can not be "ready"
This commit is contained in:
Kubernetes Prow Robot 2020-06-18 06:03:11 -07:00 committed by GitHub
commit 78b503d9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,18 +235,6 @@ func (m *manager) CleanupPods(desiredPods map[types.UID]sets.Empty) {
func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
for i, c := range podStatus.ContainerStatuses {
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 {
// The check whether there is a probe which hasn't run yet.
_, exists := m.getWorker(podUID, c.Name, readiness)
ready = !exists
}
podStatus.ContainerStatuses[i].Ready = ready
var started bool
if c.State.Running == nil {
started = false
@ -261,6 +249,20 @@ func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
started = !exists
}
podStatus.ContainerStatuses[i].Started = &started
if started {
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 {
// The check whether there is a probe which hasn't run yet.
_, exists := m.getWorker(podUID, c.Name, readiness)
ready = !exists
}
podStatus.ContainerStatuses[i].Ready = ready
}
}
// init containers are ready if they have exited with success or if a readiness probe has
// succeeded.