feat(k8s): M7 容器信息Tab — 完整容器编辑器(工作容器+初始化容器)
- 新增 DeploymentEditContainers.tsx (~700行): Kuboard 风格容器编辑器
- 工作容器 + 初始化容器分组管理(增/删/复制)
- 完整字段编辑: 镜像/拉取策略/命令/参数/工作目录
- 环境变量/端口(TCP/UDP/SCTP)/资源requests-limits
- 健康检查: liveness/readiness/startup三种探针
httpGet/tcpSocket/exec 三种检测方式可切换
- 生命周期回调: postStart/preStop (exec/httpGet/tcpSocket)
- 安全上下文: runAsUser/runAsGroup/privileged/capabilities等
- 卷挂载: name/mountPath/subPath/readOnly
- Pod级镜像拉取凭证(imagePullSecrets)编辑
- DeploymentWorkload.tsx: 容器Tab从旧DeploymentEdit替换为DeploymentEditContainers
- 纯前端工程, 后端GetYAML/UpdateYAML已完善
- 验证: tsc零错误 + vite build成功 + SPA路由200 + YAML PUT保存200
Closes M7
This commit is contained in:
1 parent
68a954c1c5
commit
a8b4af4409
5 files changed
+1078
-11
No files matched your search
+50
@@ -176,3 +176,53 @@ cd frontend && npm run build 2>&1 | tail -3
|
||||
- [x] YamlViewer 支持弹窗模式 + 内联模式(inline prop)
|
||||
- [x] DeploymentEditBasic 可编辑 replicas/labels/annotations/selector
|
||||
- [x] 编辑模式 Tab 导航系统就绪(基本信息可用 + M7-M9 预留)
|
||||
|
||||
---
|
||||
|
||||
## M7: 容器信息 Tab(工作容器 + 初始化容器)
|
||||
|
||||
### 验证用例
|
||||
|
||||
```bash
|
||||
# U1: 登录获取 Token
|
||||
TOKEN=$(curl -s http://127.0.0.1:8080/api/v1/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username":"admin","password":"admin123"}' | jq -r '.data.token')
|
||||
# 期望: code=200
|
||||
|
||||
# U2: YAML GET — 容器编辑器数据源
|
||||
curl -s "http://127.0.0.1:8080/api/v1/kubernetes/test-k8s/namespace/devops/deployments/aiops/yaml" \
|
||||
-H "Authorization: Bearer $TOKEN" | head -5
|
||||
# 期望: apiVersion: apps/v1 / kind: Deployment / containers:
|
||||
|
||||
# U3: PUT YAML 保存(容器编辑器保存路径)
|
||||
curl -s -X PUT "http://127.0.0.1:8080/api/v1/kubernetes/test-k8s/namespace/devops/deployments/aiops/yaml" \
|
||||
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/yaml" \
|
||||
-d "$(curl -s .../aiops/yaml -H "Authorization: Bearer $TOKEN")"
|
||||
# 期望: code=200
|
||||
|
||||
# U4: SPA fallback — edit 路由 200(非 301)
|
||||
curl -s -o /dev/null -w "%{http_code}" \
|
||||
"http://127.0.0.1/kubernetes/test-k8s/namespace/devops/workload/edit/Deployment/aiops"
|
||||
# 期望: 200
|
||||
|
||||
# U5: TypeScript 编译 + Vite 构建无错误
|
||||
cd frontend && npm run build 2>&1 | tail -3
|
||||
# 期望: built in Ns
|
||||
|
||||
# U6: 前端 bundle 含 DeploymentEditContainers 组件(新 hash)
|
||||
curl -s http://127.0.0.1/ | grep -oP 'index-[A-Za-z0-9]+\.js'
|
||||
# 期望: 新 hash(每次构建变化)
|
||||
```
|
||||
|
||||
### 通过标准
|
||||
- [x] U1: 登录成功
|
||||
- [x] U2: YAML API 返回含 containers 的有效 K8s manifest
|
||||
- [x] U3: PUT 保存返回 code=200
|
||||
- [x] U4: 编辑模式 SPA 路由返回 200(非 301)
|
||||
- [x] U5: TypeScript 零编译错误 + Vite 构建成功
|
||||
- [x] U6: 前端 bundle 已更新(含新组件)
|
||||
- [x] DeploymentEditContainers 支持工作容器 + 初始化容器增删
|
||||
- [x] 每个容器可编辑:镜像/拉取策略/命令/参数/环境变量/端口/资源/健康检查/生命周期/安全上下文/卷挂载
|
||||
- [x] 镜像拉取凭证(imagePullSecrets) Pod 级别编辑
|
||||
- [x] 三种探针类型(httpGet/tcpSocket/exec)可切换
|
||||
Reference in new issue
Block a user