1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Show all pod addresses (#2841)

Signed-off-by: vshakirova <vshakirova@mirantis.com>
This commit is contained in:
Violetta 2021-05-28 17:14:09 +04:00 committed by GitHub
parent fa4baf785d
commit 23dadaa1a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 0 deletions

View File

@ -280,6 +280,9 @@ export class Pod extends WorkloadKubeObject {
}[];
hostIP: string;
podIP: string;
podIPs?: {
ip: string
}[];
startTime: string;
initContainerStatuses?: IPodContainerStatus[];
containerStatuses?: IPodContainerStatus[];
@ -490,6 +493,13 @@ export class Pod extends WorkloadKubeObject {
getSelectedNodeOs(): string | undefined {
return this.spec.nodeSelector?.["kubernetes.io/os"] || this.spec.nodeSelector?.["beta.kubernetes.io/os"];
}
getIPs(): string[] {
if(!this.status.podIPs) return [];
const podIPs = this.status.podIPs;
return podIPs.map(value => value.ip);
}
}
export const podsApi = new PodsApi({

View File

@ -50,12 +50,22 @@ export interface Service {
spec: {
type: string;
clusterIP: string;
clusterIPs?: string[];
externalTrafficPolicy?: string;
externalName: string;
loadBalancerIP?: string;
loadBalancerSourceRanges?: string[];
sessionAffinity: string;
selector: { [key: string]: string };
ports: ServicePort[];
healthCheckNodePort?: number;
externalIPs?: string[]; // https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
topologyKeys?: string[];
ipFamilies?: string[];
ipFamilyPolicy?: string;
allocateLoadBalancerNodePorts?: boolean;
loadBalancerClass?: string;
internalTrafficPolicy?: string;
};
status: {
@ -82,6 +92,10 @@ export class Service extends KubeObject {
return this.spec.clusterIP;
}
getClusterIps() {
return this.spec.clusterIPs || [];
}
getExternalIps() {
const lb = this.getLoadBalancer();
@ -119,6 +133,14 @@ export class Service extends KubeObject {
getStatus() {
return this.isActive() ? "Active" : "Pending";
}
getIpFamilies() {
return this.spec.ipFamilies || [];
}
getIpFamilyPolicy() {
return this.spec.ipFamilyPolicy || "";
}
}
export const serviceApi = new KubeApi({

View File

@ -77,6 +77,22 @@ export class ServiceDetails extends React.Component<Props> {
{spec.clusterIP}
</DrawerItem>
<DrawerItem name="Cluster IPs" hidden={!service.getClusterIps().length} labelsOnly>
{
service.getClusterIps().map(label => (
<Badge key={label} label={label}/>
))
}
</DrawerItem>
<DrawerItem name="IP families" hidden={!service.getIpFamilies().length}>
{service.getIpFamilies().join(", ")}
</DrawerItem>
<DrawerItem name="IP family policy" hidden={!service.getIpFamilyPolicy()}>
{service.getIpFamilyPolicy()}
</DrawerItem>
{service.getExternalIps().length > 0 && (
<DrawerItem name="External IPs">
{service.getExternalIps().map(ip => <div key={ip}>{ip}</div>)}

View File

@ -90,6 +90,7 @@ export class PodDetails extends React.Component<Props> {
if (!pod) return null;
const { status, spec } = pod;
const { conditions, podIP } = status;
const podIPs = pod.getIPs();
const { nodeName } = spec;
const nodeSelector = pod.getNodeSelectors();
const volumes = pod.getVolumes();
@ -120,6 +121,13 @@ export class PodDetails extends React.Component<Props> {
<DrawerItem name="Pod IP">
{podIP}
</DrawerItem>
<DrawerItem name="Pod IPs" hidden={!podIPs.length} labelsOnly>
{
podIPs.map(label => (
<Badge key={label} label={label}/>
))
}
</DrawerItem>
<DrawerItem name="Priority Class">
{pod.getPriorityClassName()}
</DrawerItem>