Skip to content

Commit 3520057

Browse files
committed
fix: top running pods
1 parent 859594d commit 3520057

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/top.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CoreV1Api, V1Node, V1Pod, V1PodList } from './gen/api';
1+
import { CoreV1Api, V1Node, V1Pod, V1PodList, V1PodStatus } from './gen/api';
22
import { ContainerMetric, Metrics, PodMetric } from './metrics';
33
import {
44
add,
@@ -64,7 +64,11 @@ export async function topNodes(api: CoreV1Api): Promise<NodeStatus[]> {
6464
let totalPodMem: number | bigint = 0;
6565
let totalPodMemLimit: number | bigint = 0;
6666
let pods = await podsForNode(api, node.metadata!.name!);
67-
pods = pods.filter((pod: V1Pod) => pod.status!.phase === 'Running');
67+
pods = pods.filter(
68+
(pod: V1Pod) =>
69+
// @ts-ignore
70+
pod.status!.phase === 'Running' || pod.status!.phase === V1PodStatus.PhaseEnum.Running,
71+
);
6872
pods.forEach((pod: V1Pod) => {
6973
const cpuTotal = totalCPU(pod);
7074
totalPodCPU = add(totalPodCPU, cpuTotal.request);

0 commit comments

Comments
 (0)