Files
aiops/PROJECT_EVALUATION.md
T
attacker b3d2011243 feat(k8s): M1 SyncCluster 增加 metrics 采集
后端:
- SyncCluster 中调 GetNodeMetrics() 获取 metrics-server 数据
- 节点 INSERT 增加 cpu_usage/memory_usage 百分比字段
- 新增 parseCpuNanoToMilli / parseMemKiToMi 辅助函数
- 采集 Pod metrics(为 M2 准备)

前端:
- KubernetesClusterDetail 删除硬编码 resourceData mock
- 改为从节点 metrics 实时计算集群 CPU/内存使用率
- 图表 Y 轴固定 0-100 域,底部显示百分比数值

新增文档:
- ROADMAP.md / TDD_PLAN.md / PROJECT_EVALUATION.md
2026-06-21 21:45:42 +08:00

56 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# K8s 管理功能评估基线
> 生成时间: 2026-06-21 | 评估人: Logan + AI
## 总体规模
| 层 | 规模 |
|----|------|
| 后端 `kubernetes.go` | 2583 行 / 99 个函数 / 74 个路由 |
| 后端 `kubernetesclient/client.go` | 1486 行 |
| 前端组件 | 22 个 .tsx / 7498 行 |
## 功能评估
### ✅ 已完成(90%)
| 功能 | 后端 | 前端 | 验证状态 |
|------|:----:|:----:|:--------:|
| 集群 CRUD + 同步 | ✅ | ✅ | ✅ 已验证 |
| 集群表单(名称即 code) | ✅ | ✅ NAME_RE 正则 | ✅ |
| 节点列表 + 实时 metrics | ✅ ListNodes 调 GetNodeMetrics | ✅ ClusterOverviewPage | ⚠️ 实时OK,DB缓存缺 |
| Pod 列表 | ✅ | ✅ | ✅ |
| Deployment 列表/详情 | ✅ | ✅ DeploymentView + DeploymentWorkload | ✅ |
| Deployment view/edit 路由 | ✅ | ✅ /:mode/:kind/:name | ✅ |
| Deployment 伸缩/重启/镜像更新 | ✅ scale/restart/update-image | ✅ | ✅ |
| Deployment 历史版本/回滚 | ✅ revisions/rollback | ✅ | ✅ |
| Pod 日志(实时流) | ✅ GetPodLogs | ✅ PodLogsViewer fetch stream | ✅ |
| Pod 终端 exec | ✅ ExecTerminal(WS) | ✅ PodExecTerminal bash/sh/ash | ✅ |
| Pod 文件浏览 + 下载 | ✅ files/list + files/download | ✅ PodFileBrowser | ✅ |
| YAML 查看/编辑 | ✅ GetYAML + UpdateYAML | ✅ YamlViewer | ✅ |
| ReplicaSet 列表 | ✅ | ✅ | ✅ |
| Service/Ingress 列表 | ✅ | ✅ | ✅ |
| HPA 列表/创建/删除 | ✅ | ✅ | ✅ |
| ConfigMap/Secret 列表 | ✅ | ✅ | ✅ |
| Events 列表 | ✅ ListEvents | ✅ EventsPage | ✅ |
| 容量分析 | ✅ GetCapacityAnalysis | ✅ CapacityPage | ✅ |
| kubectl 终端 | ✅ KubectlShell(WS) | ✅ KubectlTerminal | ✅ |
| 拓扑图 | ✅ topology get/save | ✅ TopologyView | ✅ |
### ❌ 缺失(10%)
| 功能 | 优先级 | 说明 |
|------|:------:|------|
| **SyncCluster 缺 metrics 采集** | P0 | DB 里 cpu_usage/memory_usage 永远 0,详情页卡片全 0 |
| **ClusterDetail 硬编码 mock** | P0 | resourceData 7 个假点,资源分布读 DB 也是 0 |
| Pod 文件上传 | P2 | 只有下载,缺上传 |
| CI/CD 集成菜单项 | P3 | 菜单有按钮但未接线 |
| Deployment 暂停更新 | P3 | 菜单无此项 |
### ⚠️ 已知架构约束
1. **K8s 集群(161/162)是 CentOS 7** — MySQL 8.0 容器跑不了(x86-64-v2),用 hostNetwork + 外部 MySQL
2. **metrics-server 已安装** — `kubectl top nodes` 正常返回
3. **自研 K8s 客户端** — 不用 client-go,保持轻量 net/http 方案
4. **两个数据路径**:ListNodes 实时调 API(含 metrics),SyncCluster 写 DB(缺 metrics)→ 前端不同页面读不同路径