mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Pods which have not "started" can not be "ready"
Before this commit, containers which have both a `startupProbe` and a `readinessProbe` are marked as `ready=false` during stratup, but containers which have only a `startupProbe` are marked `ready=true`. This doesn't make sense. This commit only considers readiness if the container is considered to have "started", which leaves `ready=false` while starting up.
This commit is contained in:
parent
19d220073c
commit
64d4254217
@ -235,18 +235,6 @@ func (m *manager) CleanupPods(desiredPods map[types.UID]sets.Empty) {
|
|||||||
|
|
||||||
func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
|
func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
|
||||||
for i, c := range podStatus.ContainerStatuses {
|
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
|
var started bool
|
||||||
if c.State.Running == nil {
|
if c.State.Running == nil {
|
||||||
started = false
|
started = false
|
||||||
@ -261,6 +249,20 @@ func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
|
|||||||
started = !exists
|
started = !exists
|
||||||
}
|
}
|
||||||
podStatus.ContainerStatuses[i].Started = &started
|
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
|
// init containers are ready if they have exited with success or if a readiness probe has
|
||||||
// succeeded.
|
// succeeded.
|
||||||
|
Loading…
Reference in New Issue
Block a user