This commit is contained in:
Your Name
2026-04-22 14:13:21 +08:00
parent e0406b5d0e
commit 7cbde2aa78
145 changed files with 23086 additions and 2243 deletions

View File

@@ -42,6 +42,7 @@ _CRITICAL_RISK_ACTIONS = {
"deploy.rollback",
"node.bootstrap",
"cluster.reconfigure",
"runtime.reset_lab_state",
}
@@ -166,11 +167,23 @@ def _preview_single_node_policy(
node_detect_participating = bool(target_node.get("detect_participating", False))
if target_node:
if node_status in {"busy"} and action in {"runtime.stop_worker", "runtime.restart_api", "deploy.release", "deploy.rollback", "service.restart"}:
blocking_reasons.append("目标节点当前处于 busy 状态,不适合直接执行中断类动作。")
interrupt_actions = {"runtime.stop_worker", "runtime.restart_api", "service.restart"}
restart_like_actions = {"service.restart"}
rolling_deploy_actions = {"deploy.release", "deploy.rollback"}
if node_detect_participating and action in {"runtime.stop_worker", "runtime.restart_api", "deploy.release", "deploy.rollback", "service.restart"}:
if node_status in {"busy"} and action in interrupt_actions - restart_like_actions:
blocking_reasons.append("目标节点当前处于 busy 状态,不适合直接执行中断类动作。")
elif node_status in {"busy"} and action in restart_like_actions:
warnings.append("目标节点当前处于 busy 状态,重启会带来瞬时抖动,请确认当前窗口可接受。")
elif node_status in {"busy"} and action in rolling_deploy_actions:
warnings.append("目标节点当前处于 busy 状态,滚动发布会触发服务重启,请确认当前窗口可接受短暂抖动。")
if node_detect_participating and action in interrupt_actions - restart_like_actions:
blocking_reasons.append("目标节点正在参与检测,需先迁移负载或人工确认后再执行。")
elif node_detect_participating and action in restart_like_actions:
warnings.append("目标节点正在参与检测,重启会中断当前任务,请确认剩余节点仍可承接负载。")
elif node_detect_participating and action in rolling_deploy_actions:
warnings.append("目标节点正在参与检测,建议优先采用单节点滚动发布,并确认其余节点仍可承接负载。")
if node_role == "control" and action in {"runtime.restart_api", "deploy.release", "deploy.rollback", "service.restart"}:
approval_reasons.append("目标节点是 control 节点,建议强制走审批或维护窗口。")