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 { autobind } from "../../utils";
|
||||||
import { IMetrics, metricsApi } from "./metrics.api";
|
import { IMetrics, metricsApi } from "./metrics.api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { hostname } from "os";
|
|
||||||
|
|
||||||
export class IngressApi extends KubeApi<Ingress> {
|
export class IngressApi extends KubeApi<Ingress> {
|
||||||
getMetrics(ingress: string, namespace: string): Promise<IIngressMetrics> {
|
getMetrics(ingress: string, namespace: string): Promise<IIngressMetrics> {
|
||||||
@ -110,17 +109,11 @@ export class Ingress extends KubeObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLoadBalancers() {
|
getLoadBalancers() {
|
||||||
const ingressAddresses: string[] = [];
|
const { status: { loadBalancer = { ingress: [] } } } = this;
|
||||||
const { status: { loadBalancer } } = this;
|
|
||||||
|
return (loadBalancer.ingress ?? []).map(address => (
|
||||||
if (!loadBalancer) return [];
|
address.hostname || address.ip
|
||||||
|
))
|
||||||
loadBalancer.ingress.forEach(address => {
|
|
||||||
const entry = address.hostname ? address.hostname : address.ip;
|
|
||||||
ingressAddresses.push(entry);
|
|
||||||
})
|
|
||||||
|
|
||||||
return ingressAddresses;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user