From 6c873a95ec34e141243cc5e3846c69c9ce1c42d3 Mon Sep 17 00:00:00 2001 From: Martyn Dale Date: Wed, 31 Jul 2024 07:11:56 -0700 Subject: [PATCH] fix(dashboard): Update pod status logic to support native sidecars. Fixes #3366 (#3639) * Update pod status logic to support native sidecars Signed-off-by: Martyn Dale * Fix lint issues Signed-off-by: Martyn Dale --------- Signed-off-by: Martyn Dale --- pkg/kubectl-argo-rollouts/info/pod_info.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/kubectl-argo-rollouts/info/pod_info.go b/pkg/kubectl-argo-rollouts/info/pod_info.go index e53f350848..463657d70d 100644 --- a/pkg/kubectl-argo-rollouts/info/pod_info.go +++ b/pkg/kubectl-argo-rollouts/info/pod_info.go @@ -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 @@ -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 { @@ -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