Skip to content

Commit d9ced09

Browse files
committed
Update pod status logic
1 parent 7139509 commit d9ced09

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/lib/k8s/pod.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,7 @@ func GetPodStatus(pod *kcore.Pod) PodStatus {
172172
numFailed := 0
173173
numKilled := 0
174174
for _, containerStatus := range pod.Status.ContainerStatuses {
175-
if containerStatus.LastTerminationState.Terminated != nil {
176-
exitCode := containerStatus.LastTerminationState.Terminated.ExitCode
177-
if exitCode == 0 {
178-
numSucceeded++
179-
} else if killStatuses[exitCode] {
180-
numKilled++
181-
} else {
182-
numFailed++
183-
}
184-
} else if containerStatus.State.Waiting != nil {
175+
if containerStatus.State.Waiting != nil {
185176
numWaiting++
186177
} else if containerStatus.State.Running != nil {
187178
if containerStatus.Ready {
@@ -198,6 +189,15 @@ func GetPodStatus(pod *kcore.Pod) PodStatus {
198189
} else {
199190
numFailed++
200191
}
192+
} else if containerStatus.LastTerminationState.Terminated != nil {
193+
exitCode := containerStatus.LastTerminationState.Terminated.ExitCode
194+
if exitCode == 0 {
195+
numSucceeded++
196+
} else if killStatuses[exitCode] {
197+
numKilled++
198+
} else {
199+
numFailed++
200+
}
201201
} else {
202202
return PodStatusUnknown
203203
}

0 commit comments

Comments
 (0)