@@ -235,18 +235,6 @@ func (m *manager) CleanupPods(desiredPods map[types.UID]sets.Empty) {
235
235
236
236
func (m * manager ) UpdatePodStatus (podUID types.UID , podStatus * v1.PodStatus ) {
237
237
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
-
250
238
var started bool
251
239
if c .State .Running == nil {
252
240
started = false
@@ -261,6 +249,20 @@ func (m *manager) UpdatePodStatus(podUID types.UID, podStatus *v1.PodStatus) {
261
249
started = ! exists
262
250
}
263
251
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
+ }
264
266
}
265
267
// init containers are ready if they have exited with success or if a readiness probe has
266
268
// succeeded.
0 commit comments