Skip to content

Commit

Permalink
fix(dashboard): Update pod status logic to support native sidecars. F…
Browse files Browse the repository at this point in the history
…ixes #3366 (#3639)

* Update pod status logic to support native sidecars

Signed-off-by: Martyn Dale <[email protected]>

* Fix lint issues

Signed-off-by: Martyn Dale <[email protected]>

---------

Signed-off-by: Martyn Dale <[email protected]>
  • Loading branch information
martynd authored and zachaller committed Aug 13, 2024
1 parent 6a99ea9 commit 62fb6cd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/kubectl-argo-rollouts/info/pod_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func newPodInfo(pod *corev1.Pod) rollout.PodInfo {
},
}
restarts := 0
rs := make(map[string]bool, len(pod.Spec.InitContainers))
for _, c := range pod.Spec.InitContainers {
p := c.RestartPolicy
rs[c.Name] = p != nil && *p == corev1.ContainerRestartPolicyAlways
}

totalContainers := len(pod.Spec.Containers)
readyContainers := 0

Expand All @@ -69,7 +75,7 @@ func newPodInfo(pod *corev1.Pod) rollout.PodInfo {
continue
case container.State.Terminated != nil:
// initialization is failed
if len(container.State.Terminated.Reason) == 0 {
if container.State.Terminated.Reason == "" {
if container.State.Terminated.Signal != 0 {
reason = fmt.Sprintf("Init:Signal:%d", container.State.Terminated.Signal)
} else {
Expand All @@ -79,6 +85,10 @@ func newPodInfo(pod *corev1.Pod) rollout.PodInfo {
reason = "Init:" + container.State.Terminated.Reason
}
initializing = true
case rs[container.Name] && container.Started != nil && *container.Started:
if container.Ready {
continue
}
case container.State.Waiting != nil && len(container.State.Waiting.Reason) > 0 && container.State.Waiting.Reason != "PodInitializing":
reason = "Init:" + container.State.Waiting.Reason
initializing = true
Expand Down

0 comments on commit 62fb6cd

Please sign in to comment.