Skip to content

Conversation

@NorthernBob
Copy link
Contributor

Ⅰ. Describe what this PR did

Plugin server supports k8s one-click deployment and configures the default download URL of the plugin

Ⅱ. Does this pull request fix one issue?

fixes #2232 #2280 #2312

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Jun 10, 2025

CLA assistant check
All committers have signed the CLA.

@lingma-agents
Copy link

lingma-agents bot commented Jun 10, 2025

添加Higress插件服务器的Kubernetes部署支持及配置

变更文件

文件路径 变更说明
helm/core/templates/_helpers.tpl 定义插件服务器名称、标签模板和选择器逻辑,支持通过Values自定义名称、标签及Higress组件标识。
helm/​core/​templates/​plugin-server-deployment.yaml 配置Deployment包含镜像仓库地址、资源限制、端口设置及副本数,默认使用8080端口并设置CPU内存请求/限制。
helm/​core/​templates/​plugin-server-service.yaml 创建ClusterIP类型Service,默认暴露80端口,通过标签选择器关联Deployment的Pod。
helm/core/values.yaml 添加enablePluginServer开关及配套配置项,包括镜像仓库地址、资源限制、副本数等默认值设定。
helm/higress/README.md 更新文档表格说明插件服务器相关配置项,包括启用开关、资源参数及标签配置方法。

时序图

sequenceDiagram
    participant User as 用户
    participant Helm as Helm控制器
    participant Kubernetes as Kubernetes集群
    User->>Helm: 执行helm install启用enablePluginServer
    Helm->>Kubernetes: 应用plugin-server-deployment.yaml
    Kubernetes->>Kubernetes: 创建Deployment管理Pod
    Helm->>Kubernetes: 应用plugin-server-service.yaml
    Kubernetes->>Kubernetes: 创建Service暴露80端口
    Kubernetes-->>User: 返回部署成功状态
Loading

💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @Lingma-Agent 分析这个方法的性能瓶颈并提供优化建议。

  • @Lingma-Agent 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @Lingma-Agent 请总结上述讨论并提出解决方案。

  • @Lingma-Agent 请根据讨论内容生成优化代码。

Copy link

@lingma-agents lingma-agents bot left a comment

Choose a reason for hiding this comment

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

🔍 代码评审报告

🎯 评审意见概览

严重度 数量 说明
🔴 Blocker 0 阻断性问题,需立即修复。例如:系统崩溃、关键功能不可用或严重安全漏洞。
🟠 Critical 0 严重问题,高优先级修复。例如:核心功能异常或性能瓶颈影响用户体验。
🟡 Major 0 主要问题,建议修复。例如:非核心功能缺陷或代码维护性较差。
🟢 Minor 1 次要问题,酌情优化。例如:代码格式不规范或注释缺失。

总计: 1 个问题


📋 评审意见详情

💡 单文件建议

以下是文件级别的代码建议,聚焦于代码的可读性、可维护性和潜在问题。
📋 helm/core/values.yaml (1 💬)

🚀 跨文件建议

以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍 1. 镜像仓库配置的全局冗余可能导致维护困难

在values.yaml中,pluginServer.hub字段与global.hub存在重复配置。当前pluginServer的镜像地址通过hub字段单独定义,但其他组件(如Higress Gateway)可能已使用global.hub作为全局镜像仓库。这种冗余配置增加了未来维护成本,当需要统一更改镜像仓库地址时,需要修改多个地方。建议将镜像仓库配置统一到global.hub下,通过.Values.global.hub优先级继承机制实现统一管理,避免配置分散。

📌 关键代码:

hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
# 应该移除该配置,改为优先使用global.hub

⚠️ 潜在风险: 若后续需要统一更改镜像仓库地址,需要同时修改多个组件配置,容易遗漏导致部署失败

🔍 2. Kubernetes资源标签定义存在重复代码风险

在_helpers.tpl中定义的app.kubernetes.io标签结构与其他组件(如Higress Gateway)可能存在重复实现。当前pluginServer的labels模板与常规组件的标签定义逻辑类似,但未复用已有模板。建议将通用标签生成逻辑(如app.kubernetes.io相关的字段)抽象到公共模板函数中,避免不同组件间出现相似但不一致的标签定义,提升代码复用性和维护性。

📌 关键代码:

{{- define "pluginServer.labels" -}}
helm.sh/chart: {{ include "pluginServer.chart" . }}
{{ include "pluginServer.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "pluginServer.name" . }}
{{- end }}

⚠️ 潜在风险: 不同组件间标签格式不一致可能导致监控/告警系统难以统一识别资源

🔍 3. 组件启停配置未与依赖组件联动

global.enablePluginServer配置未与其他组件的启用状态建立关联。例如,若插件服务器需要依赖其他组件(如Higress Gateway)才能正常工作,但当前配置允许单独启用/禁用插件服务器,可能导致部署时出现功能缺失。建议在文档中明确插件服务器的依赖关系,或在模板中添加启用条件验证逻辑(如requirement检查)

📌 关键代码:

{{- if .Values.global.enablePluginServer }}

⚠️ 潜在风险: 用户可能在未启用必要依赖组件的情况下单独启用插件服务器,导致运行时错误


💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @Lingma-Agent 分析这个方法的性能瓶颈并提供优化建议。

  • @Lingma-Agent 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @Lingma-Agent 请总结上述讨论并提出解决方案。

  • @Lingma-Agent 请根据讨论内容生成优化代码。

Comment on lines +779 to +780
hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
tag: ""
Copy link

Choose a reason for hiding this comment

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

修正插件服务器镜像仓库配置的冗余路径

🟢 Minor | 🧹 Code Smells

📋 问题详情

hub的默认值包含仓库路径/higress,与镜像名拼接时可能导致重复路径。应将仓库路径移至镜像名中,确保配置清晰。

💡 解决方案

调整镜像仓库路径配置:

-779 +  hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
+  hub: higress-registry.cn-hangzhou.cr.aliyuncs.com
-780 +  image: plugin-server
+  image: higress/plugin-server

您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)

有用意见👍无用意见👎错误意见❌

Copy link
Collaborator

@lexburner lexburner left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.05%. Comparing base (ef31e09) to head (7ff59ae).
Report is 554 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2389       +/-   ##
===========================================
+ Coverage   35.91%   46.05%   +10.14%     
===========================================
  Files          69       81       +12     
  Lines       11576    13018     +1442     
===========================================
+ Hits         4157     5995     +1838     
+ Misses       7104     6678      -426     
- Partials      315      345       +30     

see 78 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.

@lexburner
Copy link
Collaborator

lexburner commented Jun 10, 2025

@NorthernBob 关注下 Helm Docs ci 的问题


@NorthernBob Follow the questions of Helm Docs ci

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

@lexburner lexburner merged commit 312b80f into alibaba:main Jun 11, 2025
13 checks passed
ink-hz pushed a commit to ink-hz/higress-ai-capability-auth that referenced this pull request Nov 5, 2025
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.

higress-console 提供文件服务器,支持 higress-gateway 以 http 协议下载插件

5 participants