feat(k8s): M10 Node 详情页 — PID/容器运行时/分配率

- 后端: GetNodeDetail handler — 获取单个节点完整信息
  * 系统信息: container_runtime/architecture/kubelet/os/kernel
  * 资源分配率: 遍历 Pod 计算 CPU/Memory/Pods requested vs allocatable
  * metrics-server 数据注入 (cpu_usage_m/mem_usage_mi)
  * 全量 conditions/taints/labels + 节点上的 Pod 列表
- 后端: K8s 客户端扩展
  * NodeTaint/NodeCondition 扩展字段 (reason/message)
  * NodeInfo 增加 architecture/operatingSystem
  * GetNode(name) 单节点查询方法
  * parseCpuToMilli()/parseMemToMi() 资源解析辅助函数
- 后端: 注册路由
  * GET /kubernetes/:clusterCode/nodes/:name (Kuboard code)
  * GET /kubernetes-clusters/:id/nodes/:name (ID)
- 前端: NodeDetailPage.tsx (~330行)
  * 系统信息卡片 + 资源分配率卡片(进度条)
  * 条件卡片 + 污点卡片 + 标签卡片 + Pod 列表
- 前端: 节点名称可点击跳转 (ClusterOverviewPage)
- 验证: API/SPA/TS/Vite 全部通过
This commit is contained in:
attacker committed 2026-06-23 17:57:09 +08:00
1 parent 28dfc519e1
commit 87b7755094
16 files changed
+921 -52

No files matched your search

+28 -7
View File
@@ -209,7 +209,15 @@ type NodeItem struct {
}
type NodeSpec struct {
PodCIDR string `json:"podCIDR"`
PodCIDR string `json:"podCIDR"`
Taints []NodeTaint `json:"taints,omitempty"`
}
type NodeTaint struct {
Key string `json:"key"`
Value string `json:"value"`
Effect string `json:"effect"`
TimeAdded string `json:"timeAdded,omitempty"`
}
type NodeStatus struct {
@@ -223,15 +231,19 @@ type NodeStatus struct {
type ResourceList map[string]string
type NodeCondition struct {
Type string `json:"type"`
Status string `json:"status"`
Type string `json:"type"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
type NodeInfo struct {
KubeletVersion string `json:"kubeletVersion"`
OSImage string `json:"osImage"`
KernelVersion string `json:"kernelVersion"`
KubeletVersion string `json:"kubeletVersion"`
OSImage string `json:"osImage"`
KernelVersion string `json:"kernelVersion"`
ContainerRuntimeVersion string `json:"containerRuntimeVersion"`
Architecture string `json:"architecture"`
OperatingSystem string `json:"operatingSystem"`
}
type NodeAddress struct {
@@ -421,6 +433,15 @@ func (c *Client) ListNodes() (*NodeList, error) {
return &result, nil
}
// GetNode fetches a single node by name
func (c *Client) GetNode(name string) (*NodeItem, error) {
var result NodeItem
if err := c.get("/api/v1/nodes/"+name, &result); err != nil {
return nil, err
}
return &result, nil
}
// ListPods fetches all pods across namespaces
func (c *Client) ListPods() (*PodList, error) {
var result PodList
@@ -672,7 +693,7 @@ func (c *Client) ExecInPod(namespace, podName, container string, command []strin
dialer := websocket.Dialer{
TLSClientConfig: c.TLSConfig,
Subprotocols: []string{"channel.k8s.io"},
Subprotocols: []string{"v4.channel.k8s.io", "v3.channel.k8s.io", "channel.k8s.io"},
HandshakeTimeout: 10 * time.Second,
}
header := http.Header{}