Skip to content

Commit

Permalink
fix(common): when init container restartPolicy is always, think as si…
Browse files Browse the repository at this point in the history
…decar
  • Loading branch information
linghaoSu committed Aug 13, 2024
1 parent 8622ce8 commit 6a22424
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/api/pkg/resource/pod/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func getPodStatus(pod v1.Pod) string {
for i := range pod.Status.InitContainerStatuses {
container := pod.Status.InitContainerStatuses[i]
restarts += int(container.RestartCount)
containerSpec := pod.Spec.InitContainers[i]
switch {
case container.State.Terminated == nil && *containerSpec.RestartPolicy == v1.ContainerRestartPolicyAlways:
continue;
case container.State.Terminated != nil && container.State.Terminated.ExitCode == 0:
continue
case container.State.Terminated != nil:
Expand Down

0 comments on commit 6a22424

Please sign in to comment.