mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Refactored logic to use a map
Signed-off-by: Steve Richards <srichards@mirantis.com>
This commit is contained in:
parent
6c9bf2f506
commit
82aae2946c
@ -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<Ingress> {
|
||||
getMetrics(ingress: string, namespace: string): Promise<IIngressMetrics> {
|
||||
@ -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
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user