dubbo
dubbo copied to clipboard
【xds】init xds
What is the purpose of the change
Brief changelog
Verifying this change
Checklist
- [x] Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
- [ ] Add some description to dubbo-website project if you are requesting to add a feature.
- [ ] GitHub Actions works fine on your own branch.
- [ ] If this contribution is large, please follow the Software Donation Guide.
xds client 初始化
- [ ] xds client 在dubbo中初始化的时机
- [ ] 稳定性如 keep-alive 等
- [ ] 推送机制对接是否合理,ack/nack/nounce等
- [ ] 监听器
- [ ] 初始监听的资源
- [ ] 需要的用户配置如地址等(配合控制面)
- [ ] 链接需要的证书/身份之类
组件实现与关系
- [x] 一个 interface 对应生成一个 cluster、一个directory、一个cluster invoker;
- [ ] 多个 directory(interface) 对应一个 application-name:
pilotExchanger.subscribeRds
要处理并发问题,做到多个 directory 共享一个 RdsListener - [x] Directory 的 onRdsChange onCdsChange,每个接口一个,是不是不存在并发问题?
- [x] changeClusterSubscribe 的逻辑 old/new 变更逻辑。只是不通知当前directory(interface)?还是从xds server摘除订阅unsubscribe(错误,因为cluster是共享的)?
- [x] xdsCluster.getXdsEndpoints() 的实现,endpoints 的获取具体流程;每个directory里自己去拿肯定是不合适的,因为它应该是共享的
- [ ] 和老directory逻辑的关系,之前AbstractDirectory建设的可用性检查之类的还能用吗?
- [ ] XdsClusterInvoker.doInvoke() 的具体实现目前还是空的
- [x] XdsRouter 是每个 interface 一个实例,由标准的 router chain 组装
- [ ] 注册 lds/cds/rds/eds 资源监听的逻辑,编码风格为何不一致
资源操作
- [ ] 以 provided-by 作为起始订阅 rds 资源
- [ ] 实现逻辑上考虑多个应用的情况
- [ ] Directory 关注或接收的两个关键资源变更 rds 与 eds
- [ ] onRdsChange,解析出 cds list,对关注的 cds list 进行变更(本质是 listener 订阅变更)
- [ ] onCdsChange,直接使用 cluster 去查询内存 endpoints 列表
- [ ] 地址变更事件的实际触发点(什么动作会有 invokers 刷新)
- [ ] rds 变更,为何要触发地址列表变更?
- [ ] 因为关心的 cds list 列表发生了变化?
- [ ] 变更的时机和行为是否正确,包括顺序是否正确,有没有遗漏
- [ ] eds 变更,最直接的地址变更
- [ ] 转换为 cds list 触发地址列表变更?
- [ ] cds 变更,触发总的eds资源池刷新,实际不会影响directory粒度的地址更新?
- [ ] rds 变更,为何要触发地址列表变更?
- [ ] 具体的资源解析内容分析
- [ ] rds 要解析的内容,路由 router 当前用到的内容与欠缺的内容
- [ ] cds 要解析的内容
- [ ] eds 要解析的内容,转换为 url 和 invoker 当前用到的内容与欠缺的内容
TODO
- [x] 创建XdsDirectory时传入老的接口实例对象,从中获取一些信息,这样做是否合理;
- [x] XdsClusterInvoker具体实现,可以先简单实现一版,后期看是否可以复用原先的超时、重试等功能;
- [x] 修改PilotExchanger类初始化获取资源时getResource方法命名,以防引起歧义;
- [x] 订阅资源时是否有并发问题;
- [x] Rds资源变更时是否需要变更invokers列表,一种情况是导致Cds资源减少,需要删除Cds资源对应的invokers列表;
- [x] 每个XdsRouter都拥有与自己感兴趣的XdsCluster资源,而不直接从PilotExchanger取,这样做是否会提高效率,或者直接从PilotExchanger中取影响也不大;
- [x] 目前Xds资源变更是增量的吗(增量变更的好处是为了减少资源更新风暴);
- [x] 用表格列一下Xds资源的各个字段和 Dubbo Invocation / Invoker / URL 字段 (类似于gRPC),明确从Eds资源生成Invoker时需要的字段;
- [x] 接口协议的问题,如何感知协议名称;
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 38.48%. Comparing base (
044a775
) to head (381839e
). Report is 46 commits behind head on 3.3.
Additional details and impacted files
@@ Coverage Diff @@
## 3.3 #13747 +/- ##
==========================================
- Coverage 38.71% 38.48% -0.24%
==========================================
Files 1894 1932 +38
Lines 79244 80206 +962
Branches 11529 11587 +58
==========================================
+ Hits 30682 30867 +185
- Misses 44252 45020 +768
- Partials 4310 4319 +9
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
TODO
- [x] 过滤器筛选:当用户不使用xds协议时,从XdsDirectory的过滤器链中去除XdsRouter(通过在URL参数中添加xds属性判断,xds=true表示使用xds协议)
- [ ] 将XdsDirectory放入dubbo-registry-api包下(在RegistryProtocol流程中构造XdsDirectory,再传入XdsCluster中)
- [x] Pilot Exchanger初始化:在Registry Protocol#refer()中进行PilotExchanger初始化,测试是否应该把异步初始化变为同步(异步可能会有invoker为空引发调用错误的情况)
- [ ] Cluster资源更新时,剔除停止服务的invoker
- [ ] 复用 invoker 检查逻辑
- [ ] 生成invoker时根据cds资源确定接口协议
- [ ] xds地址理想情况下应该由控制面自动注入,用户无需配置registry.address
- [ ] 自动触发XdsCluster调用,无需在@DubboReference注解中使用cluster="xds"字段
- [x] PilotExchanger初始化放在Deployer层面
- [x] 使用xds协议时,按需加载XdsRouter还是先加载XdsRouter,然后走空逻辑
- [ ] PilotExchanger已经在前置初始化,XdsDiscovery是否还有存在的必要(可能在XdsDiscovery中实现providedby和cluster、metadata的转换逻辑)
- [ ] istio其他特性实现(故障注入、超时、路由匹配是否完整)
- [x] 为Dubbo设计一套安全API接入体系(可以对接istio以外的控制面)
- [ ] 获取lds资源时没有传入lds资源的名称,当前是全量获取。调研传入applicationName是否更加合理;
- [x] 解析providedBy字段时需要支持多个应用名称,多个应用名间以逗号分隔;
the CI error may caused by https://github.com/grpc/grpc-java/issues/10601