Skip to content

Commit

Permalink
fix: Fix TypeError of topNodes. pod.status can be undefined
Browse files Browse the repository at this point in the history
Signed-off-by: koooge <koooooge@gmail.com>
  • Loading branch information
koooge committed Nov 22, 2023
1 parent 1b1a789 commit 682f793
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function topNodes(api: CoreV1Api): Promise<NodeStatus[]> {
pods = pods.filter(
(pod: V1Pod) =>
// @ts-ignore
pod.status!.phase === 'Running' || pod.status!.phase === V1PodStatus.PhaseEnum.Running,
pod.status?.phase === 'Running' || pod.status?.phase === V1PodStatus.PhaseEnum.Running,
);
pods.forEach((pod: V1Pod) => {
const cpuTotal = totalCPU(pod);
Expand Down

0 comments on commit 682f793

Please sign in to comment.