docs: add Phase 2 plan for K8s health check removal
This commit is contained in:
parent
5bce01796a
commit
ee8b73ce7f
@ -30,7 +30,15 @@
|
||||
|
||||
---
|
||||
|
||||
## 阶段 2:K8s 健康检查委托
|
||||
## 阶段 2:K8s 健康检查委托 📋 规划中
|
||||
|
||||
**目标:** 将 K8s 健康监控从网关移除,委托给 console。
|
||||
|
||||
**计划文件:** `.planning/phases/2-k8s-health-delegation/PLAN.md`
|
||||
|
||||
**需求:**
|
||||
- [ ] K8S-01:从网关注销 K8s 健康监控
|
||||
- [ ] K8S-02:网关将服务健康检查委托给 console
|
||||
|
||||
**目标:** 将 K8s 健康监控从网关移除,委托给 console。
|
||||
|
||||
@ -99,6 +107,7 @@
|
||||
| 阶段 | 名称 | 需求数 | 状态 |
|
||||
|------|------|--------|------|
|
||||
| 1 | 配置变更监听与多实例支持 | 6 | ✅ 已完成 |
|
||||
| 2 | K8s 健康检查委托 | 2 | 📋 规划中 |
|
||||
| 2 | K8s 健康检查委托 | 2 | 未规划 |
|
||||
| 3 | 安全加固 | 3 | 未规划 |
|
||||
| 4 | 性能优化 | 2 | 未规划 |
|
||||
|
||||
71
.planning/phases/2-k8s-health-delegation/PLAN.md
Normal file
71
.planning/phases/2-k8s-health-delegation/PLAN.md
Normal file
@ -0,0 +1,71 @@
|
||||
# 阶段 2 计划:K8s 健康检查委托
|
||||
|
||||
## 目标
|
||||
|
||||
将 K8s 服务健康监控从网关移除,委托给 fengling-console。网关只专注于请求路由。
|
||||
|
||||
## 需要移除的代码
|
||||
|
||||
### 1. 后台服务
|
||||
- **文件**: `src/yarpgateway/Services/KubernetesPendingSyncService.cs`
|
||||
- **操作**: 删除文件
|
||||
- **影响**: 停止每 30 秒同步 K8s 服务
|
||||
|
||||
### 2. 服务注册
|
||||
- **文件**: `src/yarpgateway/Program.cs`
|
||||
- **行号**: ~118
|
||||
- **代码**: `builder.Services.AddHostedService<KubernetesPendingSyncService>();`
|
||||
- **操作**: 删除该行
|
||||
|
||||
### 3. API 控制器
|
||||
- **文件**: `src/yarpgateway/Controllers/PendingServicesController.cs`
|
||||
- **操作**: 删除文件
|
||||
- **影响**: 移除 `/api/gateway/pending-services/*` API
|
||||
|
||||
### 4. 数据模型
|
||||
- **文件**: `src/yarpgateway/Models/GwPendingServiceDiscovery.cs`
|
||||
- **操作**: 删除文件
|
||||
- **影响**: 移除待处理服务发现实体
|
||||
|
||||
### 5. DbContext
|
||||
- **文件**: `src/yarpgateway/Data/GatewayDbContext.cs`
|
||||
- **操作**: 移除 `DbSet<GwPendingServiceDiscovery>` 属性
|
||||
|
||||
### 6. 迁移文件(可选)
|
||||
- **文件**: `src/yarpgateway/Migrations/20260222134342_AddPendingServiceDiscovery.cs`
|
||||
- **操作**: 保留(数据库已有该表)或删除(如果重新创建数据库)
|
||||
|
||||
## 不需要移除
|
||||
|
||||
| 组件 | 理由 |
|
||||
|------|------|
|
||||
| DatabaseClusterConfigProvider | YARP 集群配置仍然需要 |
|
||||
| PgSqlConfigChangeListener | 配置监听仍然需要 |
|
||||
| 现有健康检查 | YARP 内置被动健康检查 |
|
||||
|
||||
## 实现顺序
|
||||
|
||||
1. 移除 PendingServicesController.cs
|
||||
2. 移除 KubernetesPendingSyncService.cs
|
||||
3. 移除 GwPendingServiceDiscovery.cs
|
||||
4. 更新 GatewayDbContext.cs
|
||||
5. 更新 Program.cs
|
||||
6. 更新 ROADMAP.md 标记为完成
|
||||
7. 提交代码
|
||||
|
||||
## 风险
|
||||
|
||||
- **数据丢失**: 如果数据库已有 `PendingServiceDiscoveries` 表,删除代码后数据仍然存在但无法访问
|
||||
- **API 变更**: 移除 `/api/gateway/pending-services/*` 端点,需要通知 console 团队
|
||||
|
||||
## 验证
|
||||
|
||||
完成后验证:
|
||||
- `dotnet build` 成功
|
||||
- 无 `KubernetesPendingSyncService` 引用
|
||||
- 无 `PendingServicesController` 引用
|
||||
- 无 `GwPendingServiceDiscovery` 引用
|
||||
|
||||
---
|
||||
|
||||
*计划创建: 2026-03-02*
|
||||
Loading…
Reference in New Issue
Block a user