From 28af0291e7f0c04e1e6b8c2a946f86151f86d487 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 25 May 2021 10:47:53 -0700 Subject: [PATCH] Do not show terminated pods --- README.md | 4 ++++ pkg/client/client.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index dcb10ff..7879fc5 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,7 @@ istio-system 70m 2140m 14800m 570Mi 3641Mi 8934Mi kube-system 82m 1831m 3222m 1312Mi 1203Mi 2365Mi 155m 4081m 20122m 1912Mi 4989Mi 12452Mi ``` + +## Known Issues + +While init containers [play a role in resource allocation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#resources), they are not accounted for in this tool. \ No newline at end of file diff --git a/pkg/client/client.go b/pkg/client/client.go index 0c9a7c9..4d0f3e2 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -31,6 +31,9 @@ func Run(args *model.Args) error { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(info.Object.(*unstructured.Unstructured).Object, pm); err != nil { return nil } + if pm.Status.Phase == v1.PodSucceeded || pm.Status.Phase == v1.PodFailed { + return nil + } responses = append(responses, fetchPod(pm)) } return nil