Skip to content

Commit 3039cf5

Browse files
committed
Update pod status logic
(cherry picked from commit d9ced09)
1 parent e7711a8 commit 3039cf5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/lib/k8s/pod.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,7 @@ func GetPodStatus(pod *kcore.Pod) PodStatus {
170170
numFailed := 0
171171
numKilled := 0
172172
for _, containerStatus := range pod.Status.ContainerStatuses {
173-
if containerStatus.LastTerminationState.Terminated != nil {
174-
exitCode := containerStatus.LastTerminationState.Terminated.ExitCode
175-
if exitCode == 0 {
176-
numSucceeded++
177-
} else if killStatuses[exitCode] {
178-
numKilled++
179-
} else {
180-
numFailed++
181-
}
182-
} else if containerStatus.State.Waiting != nil {
173+
if containerStatus.State.Waiting != nil {
183174
numWaiting++
184175
} else if containerStatus.State.Running != nil {
185176
if containerStatus.Ready {
@@ -196,6 +187,15 @@ func GetPodStatus(pod *kcore.Pod) PodStatus {
196187
} else {
197188
numFailed++
198189
}
190+
} else if containerStatus.LastTerminationState.Terminated != nil {
191+
exitCode := containerStatus.LastTerminationState.Terminated.ExitCode
192+
if exitCode == 0 {
193+
numSucceeded++
194+
} else if killStatuses[exitCode] {
195+
numKilled++
196+
} else {
197+
numFailed++
198+
}
199199
} else {
200200
return PodStatusUnknown
201201
}

0 commit comments

Comments
 (0)