mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into back-to-catalog-button
This commit is contained in:
commit
e454b51692
21 files changed
+1555
-120
No files matched your search
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -36,7 +36,7 @@ jest.mock("fs-extra");
|
||||
jest.mock("../../notifications");
|
||||
|
||||
jest.mock("../../../../common/utils", () => ({
|
||||
...jest.requireActual("../../../../common/utils"),
|
||||
...jest.requireActual<any>("../../../../common/utils"),
|
||||
downloadFile: jest.fn(() => ({
|
||||
promise: Promise.resolve()
|
||||
})),
|
||||
|
||||
@@ -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>)}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
import { Readable } from "readable-stream";
|
||||
import type { TypedArray } from "type-fest";
|
||||
|
||||
/**
|
||||
* ReadableWebToNodeStream
|
||||
@@ -29,7 +30,7 @@ import { Readable } from "readable-stream";
|
||||
* Adds read error handler
|
||||
*
|
||||
* */
|
||||
export class ReadableWebToNodeStream extends Readable {
|
||||
export class ReadableWebToNodeStream<T extends TypedArray> extends Readable {
|
||||
|
||||
public bytesRead = 0;
|
||||
public released = false;
|
||||
@@ -38,14 +39,14 @@ export class ReadableWebToNodeStream extends Readable {
|
||||
* Default web API stream reader
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader
|
||||
*/
|
||||
private reader: ReadableStreamReader;
|
||||
private pendingRead: Promise<any>;
|
||||
private reader: ReadableStreamReader<T>;
|
||||
private pendingRead: Promise<ReadableStreamDefaultReadResult<T>>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stream ReadableStream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
|
||||
*/
|
||||
constructor(stream: ReadableStream) {
|
||||
constructor(stream: ReadableStream<T>) {
|
||||
super();
|
||||
this.reader = stream.getReader();
|
||||
}
|
||||
@@ -78,7 +79,7 @@ export class ReadableWebToNodeStream extends Readable {
|
||||
this.bytesRead += data.value.length;
|
||||
this.push(data.value); // Push new data to the queue
|
||||
}
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.push(null); // Signal EOF
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user