fengling-platform/.planning/phases/03-/03-gateway-route-update-SUMMARY.md
2026-03-03 16:10:45 +08:00

81 lines
2.9 KiB
Markdown
Raw Permalink 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.

---
phase: "03-"
plan: 02
subsystem: Gateway
tags: [gateway, domain, yarp]
dependency_graph:
requires:
- 03-gateway-cluster-entities
provides:
- 扩展的 GwTenantRoute 实体
affects:
- PlatformDbContext (需要更新以移除已删除实体的 DbSet)
tech_stack:
added:
- GwTenantRoute 新字段Methods、Hosts、Headers、LoadBalancingPolicy、AuthorizationPolicy、CorsPolicy、Transforms
patterns:
- 领域驱动设计实体扩展
key_files:
created: []
modified:
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs
deleted:
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs
decisions:
- "GwTenant 已移除 - 改用 Platform.Tenant 通过 TenantCode 关联"
- "GwServiceInstance 已移除 - 改用 GwCluster 内嵌的 Destination 集合"
- "扩展字段使用可空字符串类型,以支持可选的 YARP 配置"
metrics:
duration: ~5 分钟
completed_date: "2026-03-03"
---
# 阶段 03 计划 02: 网关路由更新总结
## 一句话概述
扩展 GwTenantRoute 以支持 YARP 路由匹配字段,并移除已废弃的 GwTenant/GwServiceInstance 实体。
## 已完成任务
| 任务 | 名称 | 提交 | 文件 |
|------|------|------|------|
| 1 | 扩展 GwTenantRoute 字段 | 3fbd9d0 | GwTenantRoute.cs |
| 2 | 删除 GwTenant 实体 | 3fbd9d0 | GwTenant.cs |
| 3 | 删除 GwServiceInstance 实体 | 3fbd9d0 | GwServiceInstance.cs |
## 总结
成功完成网关路由实体的领域层重构:
- **扩展 GwTenantRoute** 新增字段以支持完整的 YARP 路由能力:
- `Methods`、`Hosts`、`Headers` - 路由匹配
- `LoadBalancingPolicy`、`AuthorizationPolicy`、`CorsPolicy` - 策略配置
- `Transforms` - 请求/响应转换
- **移除已废弃实体**
- `GwTenant` - 应使用 Platform.Tenant 聚合并通过 TenantCode 关联
- `GwServiceInstance` - 应使用 GwCluster 内嵌的 Destination 集合
## 验证结果
- 领域层构建:**通过**0 错误2 警告)
- 基础设施层:**需要更新** - 对已删除实体的引用需在后续计划中清理
## 计划偏差
### 基础设施层引用
**发现时机:** 构建验证
**问题:** 基础设施层PlatformDbContext、InstanceStore、IInstanceStore仍引用已删除的 GwTenant 和 GwServiceInstance 实体
**影响:** 基础设施层构建失败,直到更新完成
**决策:** 推迟到后续计划 - 领域层变更已按计划范围完成
**受影响文件:** PlatformDbContext.cs、IInstanceStore.cs、InstanceStore.cs
## 备注
- 已删除的实体是初始网关实现的一部分,现已被以下替代:
- Platform.Tenant 聚合用于租户信息
- GwCluster 聚合的内嵌 Destination 集合用于服务实例
- 基础设施层清理应在下一个涵盖基础设施更新的计划中处理