Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
murongl-lyft committed Oct 17, 2024
1 parent 40aec66 commit 7923641
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/service/k8s/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,15 @@ func getPodStatus(pod *corev1.Pod) string {
totalInitContainers := len(pod.Spec.InitContainers)
nativeSidecarRestartPolicy := corev1.ContainerRestartPolicyAlways
for i := range pod.Status.InitContainerStatuses {
container := pod.Status.InitContainerStatuses[i]
restarts += int(container.RestartCount)

if pod.Spec.InitContainers[i].RestartPolicy == &nativeSidecarRestartPolicy {
// if the init container has a restart policy, it is native sidecar and should not be counted
totalInitContainers--
continue
}

container := pod.Status.InitContainerStatuses[i]
restarts += int(container.RestartCount)

switch {
case container.State.Terminated != nil && container.State.Terminated.ExitCode == 0:
continue
Expand Down

0 comments on commit 7923641

Please sign in to comment.