From 56e0cb15ac5c88a260848b388296797f82a6099e Mon Sep 17 00:00:00 2001 From: attacker Date: Sun, 14 Jun 2026 04:07:23 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E6=97=A5=E5=BF=97=20=E2=80=94=20=E8=AE=B0=E5=BD=95K8s=E9=9B=86?= =?UTF-8?q?=E7=BE=A4=E7=9B=91=E6=8E=A7=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/dev-log.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/dev-log.md b/docs/dev-log.md index 881bf0c..11837fc 100644 --- a/docs/dev-log.md +++ b/docs/dev-log.md @@ -106,3 +106,26 @@ cd ~/devops/aiops - 服务器管理模块增删改查前后端联调验证 - 成本统计从硬编码改为基于实际云账号数据计算 - 告警"通知配置"按钮功能实现(通知渠道管理弹窗) + +## 2026-06-14 04:00 自动推进 + +- **任务**: K8s集群监控数据展示 — 修复集群详情标签数据加载(数组响应未解包bug) + 补充Pod/Deployment/Service/Ingress种子数据 + deployment_count字段 +- **修改**: + - `frontend/src/components/k8s/K8sClusters.tsx` — **核心bug修复**: loadClusterDetail 中 Promise.all 的 catch fallback 返回 `{list:[]}` 但后端 ListNodes/ListPods/ListDeployments/ListServices/ListIngresses 返回 data 直接为数组(非{list,total}), 导致 `(res)?.list` 永远 undefined → 所有标签页空白; 改用 `toArray(v)` 兼容数组和对象响应; 修复 Pod 表格字段名(restarts→restart_count, cpu→cpu_usage, memory→memory_usage, node→node_name); 修复状态徽章大小写比较(status='Running' vs 'running') + - `backend/internal/models/k8s.go` — K8sCluster model 添加 DeploymentCount 字段(前端引用 cluster.deployment_count 但 model 缺失) + - `backend/scripts/mock.go` — generateK8sClusters 补充生成 Deployment/Pod/Service/Ingress 种子数据(原仅生成 Cluster+Node) + - `backend/scripts/seed_k8s_resources.go` — 新增独立种子脚本, 为已有集群补充 K8s 资源数据(幂等, 跳过已有 Pod 的集群) +- **结果**: + - `go build ./...` 编译通过 ✅ + - `npx tsc --noEmit` 类型检查通过 ✅ + - `npm run build` 构建通过 ✅ + - 种子数据写入: 4集群 → 20节点 + 80 Pod + 41 Deployment + 29 Service + 14 Ingress ✅ + - API 端到端验证: `/k8s-clusters/1/pods` 返回21条Pod数据, 字段名正确(restart_count/node_name等) ✅ + - 浏览器验证: 集群卡片显示4集群(含deployment_count), 集群详情标签页计数正确: 节点(10)/Pod(21)/Deployment(6)/Service(8)/Ingress(4) ✅ + - 无 console 错误 ✅ + - git push origin master 成功 (commit 8d47f8d) ✅ +- **下一步建议**: + - 服务器管理模块增删改查前后端联调验证 + - 成本统计从硬编码改为基于实际云账号数据计算 + - K8s 集群拓扑图(TopologyView)前后端数据联调 + - 告警"通知配置"按钮功能实现(通知渠道管理弹窗)