Skip to content

Conversation

@lcfang
Copy link
Contributor

@lcfang lcfang commented Sep 3, 2025

Ⅰ. Describe what this PR did

当在eureka或者nacos等注册的服务实例端口不一致的时候,当后端实例端口变化,会导致原来的路由配置失效,新增vport元素,固化serviceEntry中的端口,从而保证路由不失效。该功能应同时修改前端代码适配。

Ⅱ. Does this pull request fix one issue?

fixes higress-group/higress-console#518 & higress-group/higress-console#576 & #2511

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews


Ⅰ. Describe what this PR did

When the ports of service instances registered in eureka or nacos are inconsistent, when the ports of the backend instance change, the original routing configuration will be invalidated, and the new vport element will be added to solidify the ports in the serviceEntry to ensure that the routing does not fail. This function should also modify the front-end code adaptation.

Ⅱ. Does this pull request fix one issue?

fixes higress-group/higress-console#518 & higress-group/higress-console#576 & #2511

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

V. Special notes for reviews

@github-actions github-actions bot changed the title mcpbridge新增vport元素,以修复服务后端端口不一致导致的兼容性问题 mcpbridge新增vport元素,以修复服务后端端口不一致导致的兼容性问题 || =mcpbridge added a vport element to fix compatibility issues caused by inconsistent ports in the service backend Sep 3, 2025
@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.99%. Comparing base (ef31e09) to head (84607e8).
⚠️ Report is 698 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2859      +/-   ##
==========================================
+ Coverage   35.91%   44.99%   +9.08%     
==========================================
  Files          69       82      +13     
  Lines       11576    13347    +1771     
==========================================
+ Hits         4157     6006    +1849     
+ Misses       7104     6993     -111     
- Partials      315      348      +33     

see 80 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lcfang
Copy link
Contributor Author

lcfang commented Sep 3, 2025

@CH3CHO @johnlanni 这个PR麻烦尽快帮忙合入吧


@CH3CHO @johnlanni Please help me join this PR as soon as possible

clusterId: clusterId,
}
r.Cache = memory.NewCache(func() *v1.McpBridge {
return r.mcpBridge
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方有点trick,导致整体结构比较混乱,cache里还依赖CRD的描述。是不是应该在具体registry实现里处理vport相关逻辑呢?你可以只在eureka的实现里加。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但这样的话每一个 registry 就都要实现一遍,会比较麻烦。最好是找一个地方收口管理。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方有点trick,导致整体结构比较混乱,cache里还依赖CRD的描述。是不是应该在具体registry实现里处理vport相关逻辑呢?你可以只在eureka的实现里加。

这方案咋又回去了啊,最开始在registry里写的, @CH3CHO 觉得收口比较好,我觉得是OK的,优化了,放在cache里是 你建议的呢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnlanni 本来是收口方案在reconcile.go里单独加了cache
@CH3CHO @johnlanni 方案我们在明确下?这个修改影响到我们的版本升级,想要尽快确定下合入

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但这个实现太trick了,我接受不了。。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但这样的话每一个 registry 就都要实现一遍,会比较麻烦。最好是找一个地方收口管理。

如果只是eureka有这个需求,可以先只在eureka里实现,其他不用管。nacos用户目前也没有这个需求

@lcfang lcfang force-pushed the main branch 2 times, most recently from 489da87 to 9068403 Compare September 5, 2025 02:46
@lcfang
Copy link
Contributor Author

lcfang commented Sep 5, 2025

@johnlanni @CH3CHO 之前看到有个issue说nacos也有这样的需求,所以改了eureka和nacos,再帮忙看下吧


@johnlanni @CH3CHO I saw an issue that Nacos also has this demand, so I changed eureka and nacos, so I'll help you check it out

return w, nil
}

func WithMcpBridgeLister(lister listersv1.McpBridgeLister) WatcherOption {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该这样搞,你只需要vport,只要传入vport就可以了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在vport的设计是放在mcpbridge里注册中心下面的,vport需要通过mcpbridge的配置获取,并且得与注册中心和应用信息对比后再更新到serviceEntry,所以这里加了mcpbridge的监听器,这样配置更新才能及时监听到

Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外这个功能需要添加下 e2e test

Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外,请补充e2e测试

Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johnlanni johnlanni merged commit 28228ed into alibaba:main Sep 11, 2025
13 of 17 checks passed
ink-hz pushed a commit to ink-hz/higress-ai-capability-auth that referenced this pull request Nov 5, 2025
…lement to fix compatibility issues caused by inconsistent ports in the service backend (alibaba#2859)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show port info of McpBridge services可能增加路由配置的复杂度

4 participants