mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* loading k8s resources into stores per selected namespaces -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 2 - fix: generating helm chart id Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 3 Signed-off-by: Roman <ixrock@gmail.com> * fixes Signed-off-by: Roman <ixrock@gmail.com> * fixes / responding to comments Signed-off-by: Roman <ixrock@gmail.com> * chore / small fixes Signed-off-by: Roman <ixrock@gmail.com> * Watch api does not work for non-admins with lots of namespaces #1898 -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com> * make lint happy Signed-off-by: Roman <ixrock@gmail.com> * reset store on loading error Signed-off-by: Roman <ixrock@gmail.com> * added new cluster method: cluster.isAllowedResource Signed-off-by: Roman <ixrock@gmail.com> * fix: loading namespaces optimizations Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com> * fix: parse multiple kube-events from stream's chunk Signed-off-by: Roman <ixrock@gmail.com> * fix: mobx issue with accessing empty observable array by index (removes warning), use common logger Signed-off-by: Roman <ixrock@gmail.com> * fine-tuning Signed-off-by: Roman <ixrock@gmail.com> * fix: parse json stream chunks at client-side (might be partial, depends on network speed) Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 2 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 3 Signed-off-by: Roman <ixrock@gmail.com> * store subscribing refactoring -- part 4 Signed-off-by: Roman <ixrock@gmail.com> * auto-reconnect on online/offline status change, interval connection check Signed-off-by: Roman <ixrock@gmail.com> * check connection every 5m Signed-off-by: Roman <ixrock@gmail.com> * split concurrent watch-api requests by 10 at a time + 150ms delay before next call Signed-off-by: Roman <ixrock@gmail.com> * refactoring / clean up Signed-off-by: Roman <ixrock@gmail.com> * use `plimit` + delay for k8s watch requests Signed-off-by: Roman <ixrock@gmail.com> * lint fix Signed-off-by: Roman <ixrock@gmail.com> * added explicit `preload: true` when subscribing stores Signed-off-by: Roman <ixrock@gmail.com> * kubeWatchApi refactoring / fine-tuning Signed-off-by: Roman <ixrock@gmail.com> * clean up Signed-off-by: Roman <ixrock@gmail.com>
104 lines
2.9 KiB
TypeScript
104 lines
2.9 KiB
TypeScript
import "./service-details.scss";
|
|
|
|
import React from "react";
|
|
import { disposeOnUnmount, observer } from "mobx-react";
|
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
|
import { Badge } from "../badge";
|
|
import { KubeEventDetails } from "../+events/kube-event-details";
|
|
import { KubeObjectDetailsProps } from "../kube-object";
|
|
import { Service } from "../../api/endpoints";
|
|
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
|
import { ServicePortComponent } from "./service-port-component";
|
|
import { endpointStore } from "../+network-endpoints/endpoints.store";
|
|
import { ServiceDetailsEndpoint } from "./service-details-endpoint";
|
|
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
|
import { kubeWatchApi } from "../../api/kube-watch-api";
|
|
|
|
interface Props extends KubeObjectDetailsProps<Service> {
|
|
}
|
|
|
|
@observer
|
|
export class ServiceDetails extends React.Component<Props> {
|
|
componentDidMount() {
|
|
disposeOnUnmount(this, [
|
|
kubeWatchApi.subscribeStores([endpointStore], {
|
|
preload: true,
|
|
}),
|
|
]);
|
|
}
|
|
|
|
render() {
|
|
const { object: service } = this.props;
|
|
|
|
if (!service) return;
|
|
const { spec } = service;
|
|
const endpoint = endpointStore.getByName(service.getName(), service.getNs());
|
|
|
|
return (
|
|
<div className="ServicesDetails">
|
|
<KubeObjectMeta object={service}/>
|
|
|
|
<DrawerItem name="Selector" labelsOnly>
|
|
{service.getSelector().map(selector => <Badge key={selector} label={selector}/>)}
|
|
</DrawerItem>
|
|
|
|
<DrawerItem name="Type">
|
|
{spec.type}
|
|
</DrawerItem>
|
|
|
|
<DrawerItem name="Session Affinity">
|
|
{spec.sessionAffinity}
|
|
</DrawerItem>
|
|
|
|
<DrawerTitle title={`Connection`}/>
|
|
|
|
<DrawerItem name="Cluster IP">
|
|
{spec.clusterIP}
|
|
</DrawerItem>
|
|
|
|
{service.getExternalIps().length > 0 && (
|
|
<DrawerItem name="External IPs">
|
|
{service.getExternalIps().map(ip => <div key={ip}>{ip}</div>)}
|
|
</DrawerItem>
|
|
)}
|
|
|
|
<DrawerItem name="Ports">
|
|
<div>
|
|
{
|
|
service.getPorts().map((port) => (
|
|
<ServicePortComponent service={service} port={port} key={port.toString()}/>
|
|
))
|
|
}
|
|
</div>
|
|
</DrawerItem>
|
|
|
|
{spec.type === "LoadBalancer" && spec.loadBalancerIP && (
|
|
<DrawerItem name="Load Balancer IP">
|
|
{spec.loadBalancerIP}
|
|
</DrawerItem>
|
|
)}
|
|
<DrawerTitle title={`Endpoint`}/>
|
|
|
|
<ServiceDetailsEndpoint endpoint={endpoint}/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
kubeObjectDetailRegistry.add({
|
|
kind: "Service",
|
|
apiVersions: ["v1"],
|
|
components: {
|
|
Details: (props) => <ServiceDetails {...props} />
|
|
}
|
|
});
|
|
|
|
kubeObjectDetailRegistry.add({
|
|
kind: "Service",
|
|
apiVersions: ["v1"],
|
|
priority: 5,
|
|
components: {
|
|
Details: (props) => <KubeEventDetails {...props} />
|
|
}
|
|
});
|