mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Issue-772: Add LoadBalancer information to the Ingress view
Add a new LoadBalancer column in the Ingress view so that users can see the hostname or IP of the Ingress Controller to be used. Signed-off-by: Steve Richards <srichards@mirantis.com>
This commit is contained in:
parent
abe6a4e0b1
commit
6c9bf2f506
@ -2,6 +2,7 @@ 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> {
|
||||||
@ -107,6 +108,20 @@ export class Ingress extends KubeObject {
|
|||||||
}
|
}
|
||||||
return ports.join(", ")
|
return ports.join(", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ingressApi = new IngressApi({
|
export const ingressApi = new IngressApi({
|
||||||
|
|||||||
@ -39,12 +39,14 @@ export class Ingresses extends React.Component<Props> {
|
|||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
{ title: <Trans>Name</Trans>, className: "name", sortBy: sortBy.name },
|
||||||
{ title: <Trans>Namespace</Trans>, className: "namespace", sortBy: sortBy.namespace },
|
{ title: <Trans>Namespace</Trans>, className: "namespace", sortBy: sortBy.namespace },
|
||||||
|
{ title: <Trans>LoadBalancers</Trans>, className: "loadbalancers" },
|
||||||
{ title: <Trans>Rules</Trans>, className: "rules" },
|
{ title: <Trans>Rules</Trans>, className: "rules" },
|
||||||
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(ingress: Ingress) => [
|
renderTableContents={(ingress: Ingress) => [
|
||||||
ingress.getName(),
|
ingress.getName(),
|
||||||
ingress.getNs(),
|
ingress.getNs(),
|
||||||
|
ingress.getLoadBalancers().map(lb => <p key={lb}>{lb}</p>),
|
||||||
ingress.getRoutes().map(route => <p key={route}>{route}</p>),
|
ingress.getRoutes().map(route => <p key={route}>{route}</p>),
|
||||||
ingress.getAge(),
|
ingress.getAge(),
|
||||||
]}
|
]}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user