refactor(v2): upgrade module to github.com/alibaba/higress/v2#2922
refactor(v2): upgrade module to github.com/alibaba/higress/v2#2922johnlanni merged 2 commits intohigress-group:mainfrom
Conversation
Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
将 Higress 项目升级到 v2 模块版本变更概述
变更文件
时序图💡 小贴士与 lingma-agents 交流的方式📜 直接回复评论
📜 在代码行处标记
📜 在讨论中提问
|
There was a problem hiding this comment.
🔎 代码评审报告
🎯 评审意见概览
| 严重度 | 数量 | 说明 |
|---|---|---|
| 🔴 Blocker | 0 | 阻断性问题,需立即修复。例如:系统崩溃、关键功能不可用或严重安全漏洞。 |
| 🟠 Critical | 1 | 严重问题,高优先级修复。例如:核心功能异常或性能瓶颈影响用户体验。 |
| 🟡 Major | 0 | 主要问题,建议修复。例如:非核心功能缺陷或代码维护性较差。 |
| 🟢 Minor | 2 | 次要问题,酬情优化。例如:代码格式不规范或注释缺失。 |
总计: 3 个问题
📋 评审意见详情
💡 代码实现建议
以下是文件级别的代码建议,聚焦于代码的可读性、可维护性和潜在问题。
📦 api/networking/v1/mcp_bridge.proto (1 💬)
📄 client/Makefile (1 💬)
🔹 hgctl/pkg/helm/render.go (1 💬)
- 删除了未使用的变量声明。 (L31)
🚀 架构设计建议
以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍1. 模块升级后 go.mod 和导入路径的一致性问题
PR 将项目从 github.com/alibaba/higress 升级到 github.com/alibaba/higress/v2,但需要确保所有 go.mod 文件和代码中的导入路径都已正确更新。例如,hgctl/go.mod 中的 replace 规则和 require 语句是否与主模块保持一致。
📌 关键代码
module github.com/alibaba/higress/v2
module github.com/alibaba/higress/v2/hgctl
可能导致构建失败、依赖解析错误或运行时行为异常。
🔍2. 跨模块依赖管理问题
在 hgctl/go.mod 中存在 replace github.com/alibaba/higress/v2 => ../ 的规则,这可能会导致 hgctl 依赖的 higress/v2 模块版本与主项目不一致。建议使用一致的版本管理策略。
📌 关键代码
replace github.com/alibaba/higress/v2 => ../
可能导致 hgctl 与主项目之间的依赖版本不一致,引发兼容性问题。
🔍3. API 包路径更新后的兼容性问题
API 包路径已更新为 github.com/alibaba/higress/v2/api,需要确保所有引用这些 API 的客户端代码都已正确更新。例如,client/Makefile 中的 kube_source_packages 和 kube_base_output_package 是否已更新。
📌 关键代码
github.com/alibaba/higress/v2/api/networking/v1, \
github.com/alibaba/higress/v2/api/extensions/v1alpha1 \
如果客户端代码未正确更新,可能导致编译错误或运行时错误。
🔍4. 版本号和包路径在 Makefile 中的更新一致性
Makefile.core.mk 中的 VERSION_PACKAGE 已更新为 github.com/alibaba/higress/v2/pkg/cmd/lversion,需要确保其他相关配置也已同步更新,以避免版本信息不一致的问题。
📌 关键代码
VERSION_PACKAGE := github.com/alibaba/higress/v2/pkg/cmd/lversion
版本信息不一致可能导致构建或部署过程中出现错误。
🔍5. CUE 配置文件中模块路径的更新
api/cue.yaml 中的 module 路径已更新为 github.com/alibaba/higress/v2/api,需要确保所有相关的 CUE 生成逻辑和引用都已更新,以避免生成错误的 API 定义。
📌 关键代码
module: github.com/alibaba/higress/v2/apiAPI 定义生成错误可能导致客户端或服务端无法正确解析或使用 API。
审查详情
📒 文件清单 (100 个文件)
📝 变更: 100 个文件
📝 变更文件:
Makefile.core.mkapi/cue.yamlapi/extensions/v1alpha1/wasmplugin.protoapi/gen.shapi/networking/v1/http_2_rpc.protoapi/networking/v1/mcp_bridge.protoclient/Makefileclient/pkg/apis/extensions/v1alpha1/types.gen.goclient/pkg/apis/networking/v1/types.gen.goclient/pkg/applyconfiguration/extensions/v1alpha1/wasmplugin.goclient/pkg/applyconfiguration/networking/v1/http2rpc.goclient/pkg/applyconfiguration/networking/v1/mcpbridge.goclient/pkg/applyconfiguration/utils.goclient/pkg/clientset/versioned/clientset.gen.goclient/pkg/clientset/versioned/fake/clientset_generated.gen.goclient/pkg/clientset/versioned/fake/register.gen.goclient/pkg/clientset/versioned/scheme/register.gen.goclient/pkg/clientset/versioned/typed/extensions/v1alpha1/extensions_client.gen.goclient/pkg/clientset/versioned/typed/extensions/v1alpha1/fake/fake_extensions_client.gen.goclient/pkg/clientset/versioned/typed/extensions/v1alpha1/fake/fake_wasmplugin.gen.goclient/pkg/clientset/versioned/typed/extensions/v1alpha1/wasmplugin.gen.goclient/pkg/clientset/versioned/typed/networking/v1/fake/fake_http2rpc.gen.goclient/pkg/clientset/versioned/typed/networking/v1/fake/fake_mcpbridge.gen.goclient/pkg/clientset/versioned/typed/networking/v1/fake/fake_networking_client.gen.goclient/pkg/clientset/versioned/typed/networking/v1/http2rpc.gen.goclient/pkg/clientset/versioned/typed/networking/v1/mcpbridge.gen.goclient/pkg/clientset/versioned/typed/networking/v1/networking_client.gen.goclient/pkg/informers/externalversions/extensions/interface.gen.goclient/pkg/informers/externalversions/extensions/v1alpha1/interface.gen.goclient/pkg/informers/externalversions/extensions/v1alpha1/wasmplugin.gen.goclient/pkg/informers/externalversions/factory.gen.goclient/pkg/informers/externalversions/generic.gen.goclient/pkg/informers/externalversions/internalinterfaces/factory_interfaces.gen.goclient/pkg/informers/externalversions/networking/interface.gen.goclient/pkg/informers/externalversions/networking/v1/http2rpc.gen.goclient/pkg/informers/externalversions/networking/v1/interface.gen.goclient/pkg/informers/externalversions/networking/v1/mcpbridge.gen.goclient/pkg/listers/extensions/v1alpha1/wasmplugin.gen.goclient/pkg/listers/networking/v1/http2rpc.gen.goclient/pkg/listers/networking/v1/mcpbridge.gen.gocmd/higress/main.gogo.modhgctl/cmd/hgctl/config/gateway_config.gohgctl/cmd/hgctl/config/gateway_config_test.gohgctl/cmd/hgctl/main.gohgctl/go.modhgctl/pkg/code_debug.gohgctl/pkg/config_bootstrap.gohgctl/pkg/config_cluster.gohgctl/pkg/config_cmd.gohgctl/pkg/config_endpoint.gohgctl/pkg/config_listener.gohgctl/pkg/config_route.gohgctl/pkg/dashboard.gohgctl/pkg/helm/common.gohgctl/pkg/helm/object/objects.gohgctl/pkg/helm/object/objects_test.gohgctl/pkg/helm/render.gohgctl/pkg/helm/tpath/tree.gohgctl/pkg/helm/tpath/tree_test.gohgctl/pkg/helm/tpath/util.gohgctl/pkg/install.gohgctl/pkg/installer/component.gohgctl/pkg/installer/gateway_api.gohgctl/pkg/installer/helm_agent.gohgctl/pkg/installer/higress.gohgctl/pkg/installer/installer.gohgctl/pkg/installer/installer_docker.gohgctl/pkg/installer/installer_k8s.gohgctl/pkg/installer/istio.gohgctl/pkg/installer/profile_store.gohgctl/pkg/installer/server_info.gohgctl/pkg/installer/standalone.gohgctl/pkg/installer/standalone_agent.gohgctl/pkg/manifest.gohgctl/pkg/plugin/build/build.gohgctl/pkg/plugin/build/templates.gohgctl/pkg/plugin/config/create.gohgctl/pkg/plugin/config/edit.gohgctl/pkg/plugin/config/templates.gohgctl/pkg/plugin/init/init.gohgctl/pkg/plugin/init/templates.gohgctl/pkg/plugin/install/asker.gohgctl/pkg/plugin/install/install.gohgctl/pkg/plugin/ls/ls.gohgctl/pkg/plugin/plugin.gohgctl/pkg/plugin/test/clean.gohgctl/pkg/plugin/test/create.gohgctl/pkg/plugin/test/ls.gohgctl/pkg/plugin/test/start.gohgctl/pkg/plugin/test/stop.gohgctl/pkg/plugin/types/schema.gohgctl/pkg/plugin/types/testdata/types/ext/ext.gohgctl/pkg/plugin/types/testdata/types/main.gohgctl/pkg/plugin/uninstall/uninstall.gohgctl/pkg/profile_dump.gohgctl/pkg/profile_list.gohgctl/pkg/root.gohgctl/pkg/uninstall.gohgctl/pkg/upgrade.go
💡 小贴士
与 lingma-agents 交流的方式
📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:
-
在当前代码中添加详细的注释说明。
-
请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。
📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:
-
@lingma-agents 分析这个方法的性能瓶颈并提供优化建议。
-
@lingma-agents 对这个方法生成优化代码。
📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:
-
@lingma-agents 请总结上述讨论并提出解决方案。
-
@lingma-agents 请根据讨论内容生成优化代码。
|
|
||
| message RegistryConfig { | ||
| string type = 1 [(google.api.field_behavior) = REQUIRED]; | ||
| string type = 1 [(google.api.field_behavior) = REQUIRED]; |
There was a problem hiding this comment.
为 RegistryConfig 消息的 type 字段添加了必需的字段行为注解。
🟢 Minor | 🧹 Code Smells
📋 问题详情
在 RegistryConfig 消息中,type 字段被标记为必需,但缺少 google.api.field_behavior 注解。这可能导致生成的代码或文档不完整,影响 API 的清晰度和正确使用。
💡 解决方案
确保所有必需字段都包含适当的注解,以提高 API 的可读性和正确性。
- string type = 1;
+ string type = 1 [(google.api.field_behavior) = REQUIRED];您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)
|
|
||
| rename_generated_files=\ | ||
| find $(subst github.com/alibaba/higress/client/, $(empty), $(subst $(comma), $(space), $(kube_api_packages)) $(kube_clientset_package) $(kube_listers_package) $(kube_informers_package)) \ | ||
| find $(subst github.com/alibaba/higress/v2/client/, $(empty), $(subst $(comma), $(space), $(kube_api_packages)) $(kube_clientset_package) $(kube_listers_package) $(kube_informers_package)) \ |
There was a problem hiding this comment.
修正了 rename_generated_files 中的路径替换逻辑。
🟠 Critical | 🐞 Bugs
📋 问题详情
rename_generated_files 中的路径替换逻辑不正确,可能导致生成的文件重命名失败。具体来说,$(subst github.com/alibaba/higress/v2/client/, $(empty), ...) 中的逗号和空格处理可能不正确,导致路径替换失败。
💡 解决方案
修正路径替换逻辑,确保生成的文件能够正确重命名。
- find $(subst github.com/alibaba/higress/v2/client/, $(empty), $(subst $(comma), $(space), $(kube_api_packages)) $(kube_clientset_package) $(kube_listers_package) $(kube_informers_package)) \\
- -name '*.go' -and -not -name 'doc.go' -and -not -name '*.gen.go' -type f -exec sh -c 'mv "$$1" "$${1%.go}".gen.go' - '{}' \;
+ find $(subst github.com/alibaba/higress/v2/client/, , $(subst $(comma), $(space), $(kube_api_packages)) $(kube_clientset_package) $(kube_listers_package) $(kube_informers_package)) \\
+ -name '*.go' -and -not -name 'doc.go' -and -not -name '*.gen.go' -type f -exec sh -c 'mv "$$1" "$${1%.go}".gen.go' - '{}' \;您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)
| "github.com/alibaba/higress/hgctl/pkg/manifests" | ||
| "github.com/alibaba/higress/hgctl/pkg/util" | ||
| "github.com/alibaba/higress/v2/hgctl/pkg/manifests" | ||
| "github.com/alibaba/higress/v2/hgctl/pkg/util" |
There was a problem hiding this comment.
删除了未使用的变量声明。
🟢 Minor | 🧹 Code Smells
📋 问题详情
在 locateChart 函数中,cpOpts 变量被声明但未使用,这会导致编译错误或警告。
💡 解决方案
删除未使用的变量声明,以避免编译错误。
- cpOpts := &action.ChartPathOptions{
- RepoURL: repoUrl,
- Version: version,
- }
+ // cpOpts := &action.ChartPathOptions{
+ // RepoURL: repoUrl,
+ // Version: version,
+ // }您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)
Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…s-group#2922) Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
…s-group#2922) Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
…s-group#2922) Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
…s-group#2922) Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
Signed-off-by: Xijun Dai <daixijun1990@gmail.com>
Ⅰ. Describe what this PR did
内部项目中需要引用 Higress SDK 进行二次管理开发,但目前版本已经是 v2.1.x ,而包名还未升级到 v2 ,导致无法引入最新版本
所以这里将包名升级为 github.com/alibaba/higress/v2
Ⅱ. Does this pull request fix one issue?
Ⅲ. 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
The Higress SDK needs to be referenced for secondary management development in the internal project, but the current version is v2.1.x, and the package name has not been upgraded to v2, which makes it impossible to introduce the latest version
So here to upgrade the package name to github.com/alibaba/higress/v2
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
V. Special notes for reviews