Skip to content

feat: Disable leader elections in controller and pilot #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2025

Conversation

CH3CHO
Copy link
Collaborator

@CH3CHO CH3CHO commented Jun 14, 2025

Copy link

lingma-agents bot commented Jun 14, 2025

feat: 禁用控制器和pilot组件的leader选举功能

变更概述

配置调整

  • 受影响组件:控制器、pilot服务
  • 功能描述:通过环境变量配置禁用leader选举机制,确保单实例运行避免竞争
  • 实现细节
    • supervisord.conf中为controller和pilot程序添加ENABLE_LEADER_ELECTION="false"环境变量
    • 更新controller.envpilot.env配置文件添加ENABLE_LEADER_ELECTION=false设置
  • 变更原因:简化集群部署配置,避免分布式锁竞争问题,适用于单节点测试环境
变更统计
  • 📁 修改文件: 3 个文件

  • ✅ 新增代码: +5 行

  • ❌ 删除代码: -3 行

变更文件
文件路径 变更说明
all-in-one/​supervisord/​supervisord.​conf 为控制器和pilot服务添加ENABLE_LEADER_ELECTION环境变量设置为false,禁用领导选举机制
compose/env/controller.env 新增ENABLE_LEADER_ELECTION配置项并禁用alpha网关API功能
compose/env/pilot.env 在pilot环境配置中添加ENABLE_LEADER_ELECTION=false禁用选举功能

💡 小贴士

与 lingma-agents 交流的方式

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

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

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

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

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

  • @lingma-agents 对这个方法生成优化代码。

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

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

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

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 1 严重问题,高优先级修复。例如:核心功能异常或性能瓶颈影响用户体验。
🟡 Major 0 主要问题,建议修复。例如:非核心功能缺陷或代码维护性较差。
🟢 Minor 0 次要问题,酬情优化。例如:代码格式不规范或注释缺失。

总计: 1 个问题

📋 评审意见详情
💡 代码实现建议
以下是文件级别的代码建议,聚焦于代码的可读性、可维护性和潜在问题。
📄 all-in-one/supervisord/supervisord.conf (1 💬)
🚀 架构设计建议
以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍1. 禁用leader election可能导致系统高可用性风险

禁用leader election功能可能破坏系统原本依赖该机制实现的高可用性设计。在多个实例部署场景下,若未引入替代协调机制,可能导致多个实例同时执行本应由唯一leader完成的操作(如配置更新、全局状态维护等),引发数据不一致或重复操作等风险。该改动在supervisord.conf、controller.env、pilot.env三个配置文件中均设置了ENABLE_LEADER_ELECTION="false",但未提供替代的资源协调方案说明。

📌 关键代码

+environment=...,ENABLE_LEADER_ELECTION="false"
+ENABLE_LEADER_ELECTION=false
+ENABLE_LEADER_ELECTION=false

⚠️ 潜在风险

在集群环境中可能导致资源竞争、重复操作、配置冲突等系统不稳定问题

🔍2. 配置参数分散导致维护困难

相关配置参数(如ENABLE_LEADER_ELECTION)在supervisord.conf、controller.env、pilot.env三个不同文件中重复设置,未采用集中式配置管理。这种分散式配置方式会增加维护成本,当需要修改该参数时容易遗漏部分配置文件,导致配置不一致。

📌 关键代码

+environment=...,ENABLE_LEADER_ELECTION="false"
+ENABLE_LEADER_ELECTION=false
+ENABLE_LEADER_ELECTION=false

⚠️ 潜在风险

配置维护成本增加,存在配置不一致风险

🔍3. 环境变量命名一致性问题

在compose/env/pilot.env文件中存在拼写错误的环境变量ENBALE_SCOPED_RDS(已修正),但其他文件中是否还存在类似问题未全面检查。例如supervisord.conf中新增的ENABLE_LEADER_ELECTION是否与原有系统中的LEADER_ELECTION相关参数命名完全一致,需确保所有配置项命名规范统一。

📌 关键代码

ENABLE_LEADER_ELECTION="false"
ENBALE_SCOPED_RDS=true

⚠️ 潜在风险

可能导致配置参数被错误解析或覆盖,引发不可预期的行为

审查详情
📒 文件清单 (3 个文件)
📝 变更: 3 个文件

📝 变更文件:

  • all-in-one/supervisord/supervisord.conf
  • compose/env/controller.env
  • compose/env/pilot.env

💡 小贴士

与 lingma-agents 交流的方式

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

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

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

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

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

  • @lingma-agents 对这个方法生成优化代码。

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

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

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

Copy link
Contributor

@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 1446579 into higress-group:main Jul 5, 2025
3 checks passed
@CH3CHO CH3CHO deleted the feat/disable-leader-election branch July 5, 2025 08:15
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 多实例 共享 nacos存储 pilot日志持续报错 || higress Multi-instance Shared Nacos storage pilot log continues to report errors
2 participants