From 8d661caa71d000a6a8ed3e52fb9cad67daef3aee Mon Sep 17 00:00:00 2001 From: vshakirova Date: Fri, 21 May 2021 16:29:03 +0400 Subject: [PATCH] Show all pod addresses Signed-off-by: vshakirova --- src/renderer/api/endpoints/pods.api.ts | 10 +++++++++ src/renderer/api/endpoints/service.api.ts | 22 +++++++++++++++++++ .../+network-services/service-details.tsx | 16 ++++++++++++++ .../+workloads-pods/pod-details.tsx | 8 +++++++ 4 files changed, 56 insertions(+) diff --git a/src/renderer/api/endpoints/pods.api.ts b/src/renderer/api/endpoints/pods.api.ts index 8ce95ff297..bc3e5fbd86 100644 --- a/src/renderer/api/endpoints/pods.api.ts +++ b/src/renderer/api/endpoints/pods.api.ts @@ -275,6 +275,9 @@ export class Pod extends WorkloadKubeObject { }[]; hostIP: string; podIP: string; + podIPs?: { + ip: string + }[]; startTime: string; initContainerStatuses?: IPodContainerStatus[]; containerStatuses?: IPodContainerStatus[]; @@ -485,6 +488,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({ diff --git a/src/renderer/api/endpoints/service.api.ts b/src/renderer/api/endpoints/service.api.ts index 99c25f9fe7..7474e4acc8 100644 --- a/src/renderer/api/endpoints/service.api.ts +++ b/src/renderer/api/endpoints/service.api.ts @@ -59,12 +59,22 @@ export class Service extends KubeObject { 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: { @@ -80,6 +90,10 @@ export class Service extends KubeObject { return this.spec.clusterIP; } + getClusterIps() { + return this.spec.clusterIPs || []; + } + getExternalIps() { const lb = this.getLoadBalancer(); @@ -117,6 +131,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({ diff --git a/src/renderer/components/+network-services/service-details.tsx b/src/renderer/components/+network-services/service-details.tsx index f04b5687af..924e7c4288 100644 --- a/src/renderer/components/+network-services/service-details.tsx +++ b/src/renderer/components/+network-services/service-details.tsx @@ -77,6 +77,22 @@ export class ServiceDetails extends React.Component { {spec.clusterIP} + + + + + + {service.getExternalIps().length > 0 && ( {service.getExternalIps().map(ip =>
{ip}
)} diff --git a/src/renderer/components/+workloads-pods/pod-details.tsx b/src/renderer/components/+workloads-pods/pod-details.tsx index 4a67fe76d7..46859dc512 100644 --- a/src/renderer/components/+workloads-pods/pod-details.tsx +++ b/src/renderer/components/+workloads-pods/pod-details.tsx @@ -85,6 +85,7 @@ export class PodDetails extends React.Component { 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(); @@ -115,6 +116,13 @@ export class PodDetails extends React.Component { {podIP} + {pod.getPriorityClassName()}