Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard): Update pod status logic to support native sidecars. Fixes #3366 #3639

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
},
}
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

Check warning on line 59 in pkg/kubectl-argo-rollouts/info/pod_info.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubectl-argo-rollouts/info/pod_info.go#L58-L59

Added lines #L58 - L59 were not covered by tests
}

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

Expand All @@ -69,7 +75,7 @@
continue
case container.State.Terminated != nil:
// initialization is failed
if len(container.State.Terminated.Reason) == 0 {
if container.State.Terminated.Reason == "" {

Check warning on line 78 in pkg/kubectl-argo-rollouts/info/pod_info.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubectl-argo-rollouts/info/pod_info.go#L78

Added line #L78 was not covered by tests
if container.State.Terminated.Signal != 0 {
reason = fmt.Sprintf("Init:Signal:%d", container.State.Terminated.Signal)
} else {
Expand All @@ -79,6 +85,10 @@
reason = "Init:" + container.State.Terminated.Reason
}
initializing = true
case rs[container.Name] && container.Started != nil && *container.Started:
if container.Ready {
continue

Check warning on line 90 in pkg/kubectl-argo-rollouts/info/pod_info.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubectl-argo-rollouts/info/pod_info.go#L88-L90

Added lines #L88 - L90 were not covered by tests
}
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
Loading