From 0562a3ba956651fd13c86b7a55328be1a7b43c82 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 14:30:27 +0200 Subject: [PATCH 1/6] finish namespace details --- .../kubernetes/cluster/Namespace.tsx | 87 +++++++++++++++++-- 1 file changed, 82 insertions(+), 5 deletions(-) diff --git a/assets/src/components/kubernetes/cluster/Namespace.tsx b/assets/src/components/kubernetes/cluster/Namespace.tsx index 3244514501..ff8ce62681 100644 --- a/assets/src/components/kubernetes/cluster/Namespace.tsx +++ b/assets/src/components/kubernetes/cluster/Namespace.tsx @@ -1,14 +1,18 @@ import { ReactElement, useMemo } from 'react' -import { SidecarItem, useSetBreadcrumbs } from '@pluralsh/design-system' +import { SidecarItem, Table, useSetBreadcrumbs } from '@pluralsh/design-system' import { Outlet, useOutletContext, useParams } from 'react-router-dom' +import { createColumnHelper } from '@tanstack/react-table' +import { isEmpty } from 'lodash' import { Common_EventList as EventListT, Common_Event as EventT, + Limitrange_LimitRangeItem as LimitRangeT, NamespaceEventsQuery, NamespaceEventsQueryVariables, NamespaceQueryVariables, - Namespace_Namespace as NamespaceT, + Namespace_NamespaceDetail as NamespaceT, + Resourcequota_ResourceQuotaDetail as ResourceQuotaT, useNamespaceEventsQuery, useNamespaceQuery, } from '../../../generated/graphql-kubernetes' @@ -16,10 +20,9 @@ import { KubernetesClient } from '../../../helpers/kubernetes.client' import LoadingIndicator from '../../utils/LoadingIndicator' import { MetadataSidecar, useKubernetesCluster } from '../utils' import { getResourceDetailsAbsPath } from '../../../routes/kubernetesRoutesConsts' - import ResourceDetails, { TabEntry } from '../ResourceDetails' - import { ResourceList } from '../ResourceList' +import { SubTitle } from '../../cluster/nodes/SubTitle' import { getBreadcrumbs } from './Namespaces' import { NamespacePhaseChip } from './utils' @@ -76,10 +79,84 @@ export default function Namespace(): ReactElement { ) } +const rqColumnHelper = createColumnHelper() + +const rqColumns = [ + rqColumnHelper.accessor((rq) => rq?.objectMeta.name, { + id: 'name', + header: 'Name', + cell: ({ getValue }) => getValue(), + }), + rqColumnHelper.accessor((rq) => rq?.scopes, { + id: 'scopes', + header: 'Scopes', + cell: ({ getValue }) => getValue()?.map((scope) =>
{scope}
), + }), + rqColumnHelper.accessor((rq) => rq?.statusList, { + id: 'statusList', + header: 'Status list', + cell: ({ getValue }) => JSON.stringify(getValue()), + }), +] + +const lrColumnHelper = createColumnHelper() + +const lrColumns = [ + lrColumnHelper.accessor((lr) => lr?.resourceName, { + id: 'name', + header: 'Name', + cell: ({ getValue }) => getValue(), + }), + lrColumnHelper.accessor((lr) => lr?.resourceType, { + id: 'type', + header: 'Type', + cell: ({ getValue }) => getValue(), + }), + lrColumnHelper.accessor((lr) => lr?.default, { + id: 'default', + header: 'Default', + cell: ({ getValue }) => getValue(), + }), + lrColumnHelper.accessor((lr) => lr?.defaultRequest, { + id: 'defaultRequest', + header: 'Default request', + cell: ({ getValue }) => getValue(), + }), +] + export function NamespaceInfo(): ReactElement { const namespace = useOutletContext() as NamespaceT - return
TODO
+ return ( + <> + {!isEmpty(namespace?.resourceQuotaList?.items) && ( +
+ Resource quotas + + + )} + {!isEmpty(namespace?.resourceLimits) && ( +
+ Resource limits +
+ + )} + + ) } export function NamespaceEvents(): ReactElement { From 2a677a317c1620ce4b3646e1e54e81eb09fc47bc Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 14:31:44 +0200 Subject: [PATCH 2/6] post merge fix --- assets/src/components/kubernetes/cluster/Namespace.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/src/components/kubernetes/cluster/Namespace.tsx b/assets/src/components/kubernetes/cluster/Namespace.tsx index ff8ce62681..0128e9f0c5 100644 --- a/assets/src/components/kubernetes/cluster/Namespace.tsx +++ b/assets/src/components/kubernetes/cluster/Namespace.tsx @@ -26,7 +26,7 @@ import { SubTitle } from '../../cluster/nodes/SubTitle' import { getBreadcrumbs } from './Namespaces' import { NamespacePhaseChip } from './utils' -import { COLUMNS } from './Events' +import { useEventsColumns } from './Events' const directory: Array = [ { path: '', label: 'Info' }, @@ -161,6 +161,7 @@ export function NamespaceInfo(): ReactElement { export function NamespaceEvents(): ReactElement { const { name } = useParams() + const columns = useEventsColumns() return ( namespaced - columns={COLUMNS} + columns={columns} query={useNamespaceEventsQuery} queryOptions={{ variables: { name } as NamespaceEventsQueryVariables, From 7de38ed5f4950119a24d1d10b7b642225cdb8310 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 15:11:36 +0200 Subject: [PATCH 3/6] node details improvements --- .../components/kubernetes/cluster/Node.tsx | 79 ++++++++++++++++--- assets/src/generated/graphql-kubernetes.ts | 13 ++- .../src/graph-kubernetes/cluster/node.graphql | 11 +++ 3 files changed, 90 insertions(+), 13 deletions(-) diff --git a/assets/src/components/kubernetes/cluster/Node.tsx b/assets/src/components/kubernetes/cluster/Node.tsx index 838077ec66..0ff72647d3 100644 --- a/assets/src/components/kubernetes/cluster/Node.tsx +++ b/assets/src/components/kubernetes/cluster/Node.tsx @@ -1,14 +1,21 @@ import { ReactElement, useMemo } from 'react' -import { SidecarItem, useSetBreadcrumbs } from '@pluralsh/design-system' +import { + Card, + ChipList, + SidecarItem, + useSetBreadcrumbs, +} from '@pluralsh/design-system' import { Outlet, useOutletContext, useParams } from 'react-router-dom' +import { useTheme } from 'styled-components' + import { Common_EventList as EventListT, Common_Event as EventT, NodeEventsQuery, NodeEventsQueryVariables, NodeQueryVariables, - Node_Node as NodeT, + Node_NodeDetail as NodeT, useNodeEventsQuery, useNodeQuery, } from '../../../generated/graphql-kubernetes' @@ -21,9 +28,13 @@ import ResourceDetails, { TabEntry } from '../ResourceDetails' import { ResourceList } from '../ResourceList' -import { getBreadcrumbs } from './Namespaces' -import { NamespacePhaseChip } from './utils' -import { COLUMNS } from './Events' +import { SubTitle } from '../../cluster/nodes/SubTitle' + +import { ResourceInfoCardEntry } from '../common/ResourceInfoCard' + +import { getBreadcrumbs } from './Nodes' +import { useEventsColumns } from './Events' +import { NodeReadyChip } from './utils' const directory: Array = [ { path: '', label: 'Info' }, @@ -43,7 +54,7 @@ export default function Node(): ReactElement { } as NodeQueryVariables, }) - const namespace = data?.handleGetNodeDetail + const node = data?.handleGetNodeDetail useSetBreadcrumbs( useMemo( @@ -64,31 +75,75 @@ export default function Node(): ReactElement { - - + + + {/* TODO: Fix on the API side? It works in the list view. */} + + {/* TODO: Fix on the API side? */} + {node?.phase} } > - + ) } export function NodeInfo(): ReactElement { + const theme = useTheme() const node = useOutletContext() as NodeT - return
TODO
+ return ( +
+ Info + + + {node?.providerID} + + + {node?.unschedulable ? 'True' : 'False'} + + + {node?.podCIDR} + + + `${a?.type}: ${a?.address}`} + emptyState={
None
} + /> +
+ + `${t?.key}=${t?.value}:${t?.effect}`} + emptyState={
None
} + /> +
+
+
+ ) } export function NodeEvents(): ReactElement { const { name } = useParams() + const columns = useEventsColumns() return ( namespaced - columns={COLUMNS} + columns={columns} query={useNodeEventsQuery} queryOptions={{ variables: { name } as NodeEventsQueryVariables, diff --git a/assets/src/generated/graphql-kubernetes.ts b/assets/src/generated/graphql-kubernetes.ts index 69b8f93a44..3d25897d45 100644 --- a/assets/src/generated/graphql-kubernetes.ts +++ b/assets/src/generated/graphql-kubernetes.ts @@ -4737,7 +4737,7 @@ export type NodeQueryVariables = Exact<{ }>; -export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string } } | null }; +export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, unschedulable: boolean, ready: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string }, addresses?: Array<{ __typename?: 'v1_NodeAddress', type: string, address: string } | null> | null, taints?: Array<{ __typename?: 'v1_Taint', key: string, value?: string | null, effect: string } | null> | null } | null }; export type NodeEventsQueryVariables = Exact<{ name: Scalars['String']['input']; @@ -6392,10 +6392,21 @@ export const NodeDocument = gql` osImage systemUUID } + addresses { + type + address + } + taints { + key + value + effect + } providerID containerImages podCIDR phase + unschedulable + ready errors } } diff --git a/assets/src/graph-kubernetes/cluster/node.graphql b/assets/src/graph-kubernetes/cluster/node.graphql index f42dc2321c..8d7b5e36f9 100644 --- a/assets/src/graph-kubernetes/cluster/node.graphql +++ b/assets/src/graph-kubernetes/cluster/node.graphql @@ -60,10 +60,21 @@ query Node($name: String!) { osImage systemUUID } + addresses { + type + address + } + taints { + key + value + effect + } providerID containerImages podCIDR phase + unschedulable + ready errors } } From f41fdef7169ec86180066a9f2eac02c021802542 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 15:25:12 +0200 Subject: [PATCH 4/6] node details improvements --- .../components/kubernetes/cluster/Node.tsx | 32 ++++++++++++++++++- .../src/graph-kubernetes/cluster/node.graphql | 11 +++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/assets/src/components/kubernetes/cluster/Node.tsx b/assets/src/components/kubernetes/cluster/Node.tsx index 0ff72647d3..7022ff3b79 100644 --- a/assets/src/components/kubernetes/cluster/Node.tsx +++ b/assets/src/components/kubernetes/cluster/Node.tsx @@ -96,7 +96,7 @@ export function NodeInfo(): ReactElement { return (
- Info + Node information None} /> + + {node?.nodeInfo.machineID} + + + {node?.nodeInfo.systemUUID} + + + {node?.nodeInfo.bootID} + + + {node?.nodeInfo.kernelVersion} + + + {node?.nodeInfo.osImage} + + + {node?.nodeInfo.containerRuntimeVersion} + + + {node?.nodeInfo.kubeletVersion} + + + {node?.nodeInfo.kubeProxyVersion} + + + {node?.nodeInfo.operatingSystem} + + + {node?.nodeInfo.architecture} +
) diff --git a/assets/src/graph-kubernetes/cluster/node.graphql b/assets/src/graph-kubernetes/cluster/node.graphql index 8d7b5e36f9..0150a3a800 100644 --- a/assets/src/graph-kubernetes/cluster/node.graphql +++ b/assets/src/graph-kubernetes/cluster/node.graphql @@ -60,6 +60,17 @@ query Node($name: String!) { osImage systemUUID } + allocatedResources { + cpuRequests + cpuRequestsFraction + cpuCapacity + memoryRequests + memoryRequestsFraction + memoryCapacity + allocatedPods + podFraction + podCapacity + } addresses { type address From 91f8ad84d620f7898431df2823998ba01e10d2a3 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 15:55:50 +0200 Subject: [PATCH 5/6] fetch node pods --- .../components/kubernetes/cluster/Node.tsx | 188 +++++++++++------- assets/src/generated/graphql-kubernetes.ts | 62 +++++- .../src/graph-kubernetes/cluster/node.graphql | 15 ++ assets/src/routes/kubernetesRoutes.tsx | 5 + 4 files changed, 200 insertions(+), 70 deletions(-) diff --git a/assets/src/components/kubernetes/cluster/Node.tsx b/assets/src/components/kubernetes/cluster/Node.tsx index 7022ff3b79..da98cf5c56 100644 --- a/assets/src/components/kubernetes/cluster/Node.tsx +++ b/assets/src/components/kubernetes/cluster/Node.tsx @@ -1,4 +1,4 @@ -import { ReactElement, useMemo } from 'react' +import React, { ReactElement, useMemo } from 'react' import { Card, ChipList, @@ -14,9 +14,14 @@ import { Common_Event as EventT, NodeEventsQuery, NodeEventsQueryVariables, + NodePodsQuery, + NodePodsQueryVariables, NodeQueryVariables, Node_NodeDetail as NodeT, + Pod_PodList as PodListT, + Pod_Pod as PodT, useNodeEventsQuery, + useNodePodsQuery, useNodeQuery, } from '../../../generated/graphql-kubernetes' import { KubernetesClient } from '../../../helpers/kubernetes.client' @@ -32,12 +37,17 @@ import { SubTitle } from '../../cluster/nodes/SubTitle' import { ResourceInfoCardEntry } from '../common/ResourceInfoCard' +import { GaugeWrap, ResourceGauge } from '../../cluster/Gauges' + +import { usePodColumns } from '../workloads/Pods' + import { getBreadcrumbs } from './Nodes' import { useEventsColumns } from './Events' import { NodeReadyChip } from './utils' const directory: Array = [ { path: '', label: 'Info' }, + { path: 'pods', label: 'Pods' }, { path: 'events', label: 'Events' }, { path: 'raw', label: 'Raw' }, ] as const @@ -95,74 +105,114 @@ export function NodeInfo(): ReactElement { const node = useOutletContext() as NodeT return ( -
- Node information - - - {node?.providerID} - - - {node?.unschedulable ? 'True' : 'False'} - - - {node?.podCIDR} - - - `${a?.type}: ${a?.address}`} - emptyState={
None
} - /> -
- - `${t?.key}=${t?.value}:${t?.effect}`} - emptyState={
None
} - /> -
- - {node?.nodeInfo.machineID} - - - {node?.nodeInfo.systemUUID} - - - {node?.nodeInfo.bootID} - - - {node?.nodeInfo.kernelVersion} - - - {node?.nodeInfo.osImage} - - - {node?.nodeInfo.containerRuntimeVersion} - - - {node?.nodeInfo.kubeletVersion} - - - {node?.nodeInfo.kubeProxyVersion} - - - {node?.nodeInfo.operatingSystem} - - - {node?.nodeInfo.architecture} - -
-
+ <> +
+ Allocated resources + + + + + TODO + +
+
+ Node information + + + {node?.providerID} + + + {node?.unschedulable ? 'True' : 'False'} + + + {node?.podCIDR} + + + `${a?.type}: ${a?.address}`} + emptyState={
None
} + /> +
+ + `${t?.key}=${t?.value}:${t?.effect}`} + emptyState={
None
} + /> +
+ + {node?.nodeInfo.machineID} + + + {node?.nodeInfo.systemUUID} + + + {node?.nodeInfo.bootID} + + + {node?.nodeInfo.kernelVersion} + + + {node?.nodeInfo.osImage} + + + {node?.nodeInfo.containerRuntimeVersion} + + + {node?.nodeInfo.kubeletVersion} + + + {node?.nodeInfo.kubeProxyVersion} + + + {node?.nodeInfo.operatingSystem} + + + {node?.nodeInfo.architecture} + +
+
+ + ) +} + +export function NodePods(): ReactElement { + const { name } = useParams() + const columns = usePodColumns() + + // TODO: Pagination etc. + return ( + + namespaced + columns={columns} + query={useNodePodsQuery} + queryOptions={{ + variables: { name } as NodePodsQueryVariables, + }} + queryName="handleGetNodePods" + itemsKey="pods" + disableOnRowClick + /> ) } diff --git a/assets/src/generated/graphql-kubernetes.ts b/assets/src/generated/graphql-kubernetes.ts index 3d25897d45..4659bb5830 100644 --- a/assets/src/generated/graphql-kubernetes.ts +++ b/assets/src/generated/graphql-kubernetes.ts @@ -4737,7 +4737,15 @@ export type NodeQueryVariables = Exact<{ }>; -export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, unschedulable: boolean, ready: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string }, addresses?: Array<{ __typename?: 'v1_NodeAddress', type: string, address: string } | null> | null, taints?: Array<{ __typename?: 'v1_Taint', key: string, value?: string | null, effect: string } | null> | null } | null }; +export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, unschedulable: boolean, ready: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string }, allocatedResources: { __typename?: 'node_NodeAllocatedResources', cpuRequests: any, cpuRequestsFraction: number, cpuCapacity: any, memoryRequests: any, memoryRequestsFraction: number, memoryCapacity: any, allocatedPods: number, podFraction: number, podCapacity: any }, addresses?: Array<{ __typename?: 'v1_NodeAddress', type: string, address: string } | null> | null, taints?: Array<{ __typename?: 'v1_Taint', key: string, value?: string | null, effect: string } | null> | null } | null }; + +export type NodePodsQueryVariables = Exact<{ + namespace: Scalars['String']['input']; + name: Scalars['String']['input']; +}>; + + +export type NodePodsQuery = { __typename?: 'Query', handleGetNodePods?: { __typename?: 'pod_PodList', listMeta: { __typename?: 'types_ListMeta', totalItems: number }, pods: Array<{ __typename?: 'pod_Pod', status: string, containerImages: Array, nodeName: string, restartCount: number, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, warnings: Array<{ __typename?: 'common_Event', message: string } | null> } | null> } | null }; export type NodeEventsQueryVariables = Exact<{ name: Scalars['String']['input']; @@ -6392,6 +6400,17 @@ export const NodeDocument = gql` osImage systemUUID } + allocatedResources { + cpuRequests + cpuRequestsFraction + cpuCapacity + memoryRequests + memoryRequestsFraction + memoryCapacity + allocatedPods + podFraction + podCapacity + } addresses { type address @@ -6445,6 +6464,47 @@ export type NodeQueryHookResult = ReturnType; export type NodeLazyQueryHookResult = ReturnType; export type NodeSuspenseQueryHookResult = ReturnType; export type NodeQueryResult = Apollo.QueryResult; +export const NodePodsDocument = gql` + query NodePods($namespace: String!, $name: String!) { + handleGetNodePods(name: $name) @rest(type: "pod_PodList", path: "node/{args.name}/pod") { + ...PodList + } +} + ${PodListFragmentDoc}`; + +/** + * __useNodePodsQuery__ + * + * To run a query within a React component, call `useNodePodsQuery` and pass it any options that fit your needs. + * When your component renders, `useNodePodsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNodePodsQuery({ + * variables: { + * namespace: // value for 'namespace' + * name: // value for 'name' + * }, + * }); + */ +export function useNodePodsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NodePodsDocument, options); + } +export function useNodePodsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NodePodsDocument, options); + } +export function useNodePodsSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(NodePodsDocument, options); + } +export type NodePodsQueryHookResult = ReturnType; +export type NodePodsLazyQueryHookResult = ReturnType; +export type NodePodsSuspenseQueryHookResult = ReturnType; +export type NodePodsQueryResult = Apollo.QueryResult; export const NodeEventsDocument = gql` query NodeEvents($name: String!, $filterBy: String, $sortBy: String, $itemsPerPage: String, $page: String) { handleGetNodeEvents( diff --git a/assets/src/graph-kubernetes/cluster/node.graphql b/assets/src/graph-kubernetes/cluster/node.graphql index 0150a3a800..6440e6d295 100644 --- a/assets/src/graph-kubernetes/cluster/node.graphql +++ b/assets/src/graph-kubernetes/cluster/node.graphql @@ -90,6 +90,21 @@ query Node($name: String!) { } } +query NodePods( + $namespace: String! + $name: String! +) { + handleGetNodePods( + name: $name + ) + @rest( + type: "pod_PodList" + path: "node/{args.name}/pod" + ) { + ...PodList + } +} + query NodeEvents( $name: String! $filterBy: String diff --git a/assets/src/routes/kubernetesRoutes.tsx b/assets/src/routes/kubernetesRoutes.tsx index a684ab56d8..71965e57aa 100644 --- a/assets/src/routes/kubernetesRoutes.tsx +++ b/assets/src/routes/kubernetesRoutes.tsx @@ -47,6 +47,7 @@ import Nodes from '../components/kubernetes/cluster/Nodes' import Node, { NodeEvents, NodeInfo, + NodePods, } from '../components/kubernetes/cluster/Node' import Events from '../components/kubernetes/cluster/Events' import Namespaces from '../components/kubernetes/cluster/Namespaces' @@ -517,6 +518,10 @@ export const kubernetesRoutes = [ path="" element={} /> + } + /> } From c24d3807308ae0fabf88bd31e2a163adeeefe9ce Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 2 Apr 2024 16:02:46 +0200 Subject: [PATCH 6/6] add node conditions --- .../components/kubernetes/cluster/Node.tsx | 6 ++++ assets/src/generated/graphql-kubernetes.ts | 30 +++++++++++-------- .../src/graph-kubernetes/cluster/node.graphql | 25 +++++++++------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/assets/src/components/kubernetes/cluster/Node.tsx b/assets/src/components/kubernetes/cluster/Node.tsx index da98cf5c56..22593018f1 100644 --- a/assets/src/components/kubernetes/cluster/Node.tsx +++ b/assets/src/components/kubernetes/cluster/Node.tsx @@ -41,6 +41,8 @@ import { GaugeWrap, ResourceGauge } from '../../cluster/Gauges' import { usePodColumns } from '../workloads/Pods' +import Conditions from '../common/Conditions' + import { getBreadcrumbs } from './Nodes' import { useEventsColumns } from './Events' import { NodeReadyChip } from './utils' @@ -124,6 +126,10 @@ export function NodeInfo(): ReactElement { TODO +
+ Conditions + +
Node information ; -export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, unschedulable: boolean, ready: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string }, allocatedResources: { __typename?: 'node_NodeAllocatedResources', cpuRequests: any, cpuRequestsFraction: number, cpuCapacity: any, memoryRequests: any, memoryRequestsFraction: number, memoryCapacity: any, allocatedPods: number, podFraction: number, podCapacity: any }, addresses?: Array<{ __typename?: 'v1_NodeAddress', type: string, address: string } | null> | null, taints?: Array<{ __typename?: 'v1_Taint', key: string, value?: string | null, effect: string } | null> | null } | null }; +export type NodeQuery = { __typename?: 'Query', handleGetNodeDetail?: { __typename?: 'node_NodeDetail', providerID: string, containerImages: Array, podCIDR: string, phase: string, unschedulable: boolean, ready: string, errors: Array, typeMeta: { __typename?: 'types_TypeMeta', kind?: string | null, restartable?: boolean | null, scalable?: boolean | null }, objectMeta: { __typename?: 'types_ObjectMeta', uid?: string | null, name?: string | null, namespace?: string | null, labels?: any | null, annotations?: any | null, creationTimestamp?: string | null }, conditions: Array<{ __typename?: 'common_Condition', message: string, type: string, status: string, lastProbeTime: string, lastTransitionTime: string, reason: string } | null>, allocatedResources: { __typename?: 'node_NodeAllocatedResources', cpuRequests: any, cpuRequestsFraction: number, cpuCapacity: any, memoryRequests: any, memoryRequestsFraction: number, memoryCapacity: any, allocatedPods: number, podFraction: number, podCapacity: any }, nodeInfo: { __typename?: 'v1_NodeSystemInfo', architecture: string, bootID: string, containerRuntimeVersion: string, kernelVersion: string, kubeletVersion: string, kubeProxyVersion: string, machineID: string, operatingSystem: string, osImage: string, systemUUID: string }, addresses?: Array<{ __typename?: 'v1_NodeAddress', type: string, address: string } | null> | null, taints?: Array<{ __typename?: 'v1_Taint', key: string, value?: string | null, effect: string } | null> | null } | null }; export type NodePodsQueryVariables = Exact<{ namespace: Scalars['String']['input']; @@ -6388,17 +6388,8 @@ export const NodeDocument = gql` objectMeta @type(name: "types_ObjectMeta") { ...ObjectMeta } - nodeInfo { - architecture - bootID - containerRuntimeVersion - kernelVersion - kubeletVersion - kubeProxyVersion - machineID - operatingSystem - osImage - systemUUID + conditions @type(name: "common_Condition") { + ...Condition } allocatedResources { cpuRequests @@ -6411,6 +6402,18 @@ export const NodeDocument = gql` podFraction podCapacity } + nodeInfo { + architecture + bootID + containerRuntimeVersion + kernelVersion + kubeletVersion + kubeProxyVersion + machineID + operatingSystem + osImage + systemUUID + } addresses { type address @@ -6430,7 +6433,8 @@ export const NodeDocument = gql` } } ${TypeMetaFragmentDoc} -${ObjectMetaFragmentDoc}`; +${ObjectMetaFragmentDoc} +${ConditionFragmentDoc}`; /** * __useNodeQuery__ diff --git a/assets/src/graph-kubernetes/cluster/node.graphql b/assets/src/graph-kubernetes/cluster/node.graphql index 6440e6d295..b57ba21d5a 100644 --- a/assets/src/graph-kubernetes/cluster/node.graphql +++ b/assets/src/graph-kubernetes/cluster/node.graphql @@ -48,17 +48,8 @@ query Node($name: String!) { objectMeta @type(name: "types_ObjectMeta") { ...ObjectMeta } - nodeInfo { - architecture - bootID - containerRuntimeVersion - kernelVersion - kubeletVersion - kubeProxyVersion - machineID - operatingSystem - osImage - systemUUID + conditions @type(name: "common_Condition") { + ...Condition } allocatedResources { cpuRequests @@ -71,6 +62,18 @@ query Node($name: String!) { podFraction podCapacity } + nodeInfo { + architecture + bootID + containerRuntimeVersion + kernelVersion + kubeletVersion + kubeProxyVersion + machineID + operatingSystem + osImage + systemUUID + } addresses { type address