diff --git a/src/renderer/api/endpoints/ingress.api.ts b/src/renderer/api/endpoints/ingress.api.ts index 68911fb882..8f81f3a05d 100644 --- a/src/renderer/api/endpoints/ingress.api.ts +++ b/src/renderer/api/endpoints/ingress.api.ts @@ -2,7 +2,6 @@ import { KubeObject } from "../kube-object"; import { autobind } from "../../utils"; import { IMetrics, metricsApi } from "./metrics.api"; import { KubeApi } from "../kube-api"; -import { hostname } from "os"; export class IngressApi extends KubeApi { getMetrics(ingress: string, namespace: string): Promise { @@ -110,17 +109,11 @@ export class Ingress extends KubeObject { } getLoadBalancers() { - const ingressAddresses: string[] = []; - const { status: { loadBalancer } } = this; - - if (!loadBalancer) return []; - - loadBalancer.ingress.forEach(address => { - const entry = address.hostname ? address.hostname : address.ip; - ingressAddresses.push(entry); - }) - - return ingressAddresses; + const { status: { loadBalancer = { ingress: [] } } } = this; + + return (loadBalancer.ingress ?? []).map(address => ( + address.hostname || address.ip + )) } }