fix(capacity): 允许显式禁用无节点站点

当 Worker Deployment 为零副本且站点没有 eligible Worker 节点时返回零容量状态,避免 min/max=0 的禁用站点令容量控制器持续 NotReady;非零副本仍保持失败关闭。\n\n验证:容量控制器单测、Go 全量测试、go vet、gofmt、迁移安全检查和人工发布脚本测试。
This commit is contained in:
2026-08-01 13:02:55 +08:00
parent 773d310214
commit 80801b7bbb
2 changed files with 72 additions and 0 deletions
@@ -179,6 +179,13 @@ func (client *KubernetesClient) SiteState(ctx context.Context, site string) (Kub
return KubernetesSiteState{}, err
}
if len(nodes.Items) == 0 {
// A zero-replica Deployment with no eligible nodes represents an
// explicitly disabled site. It must remain visible to the planner, but it
// has no node or metrics budget to collect. A non-zero Deployment still
// fails closed so replicas cannot disappear from capacity accounting.
if state.CurrentReplicas == 0 {
return state, nil
}
return KubernetesSiteState{}, fmt.Errorf("site %s has no matching nodes", site)
}
var pods struct {