feat(distributed): 支持单主控多节点部署和停服迁移
复用现有 k3s 调度和 Job 生命周期,增加 worker 接入与批准、受保护节点身份、归档传输、持久迁移锁及活动 PVC 切换;同步管理员 API、CLI、面板和隔离规则。分布式模式默认关闭,保持单机兼容。 验证:Go 全量测试与 vet;面板 874 个测试、lint/build;Linux VM 安装器测试、清单服务端 dry-run、网络命名空间防火墙实测。A/B/C 三机 WireGuard、Velocity 和迁移验收仍待完成。
This commit is contained in:
77 files changed
+5224
-73
No files matched your search
@@ -20,6 +20,7 @@ import (
|
||||
var static embed.FS
|
||||
|
||||
type runtimeConfig struct {
|
||||
Distributed bool `json:"distributed,omitempty"`
|
||||
APIBase string `json:"apiBase"`
|
||||
RootDomain string `json:"rootDomain"`
|
||||
PanelHostname string `json:"panelHostname,omitempty"`
|
||||
@@ -112,13 +113,14 @@ func parseBuildVersion(raw string) buildInfo {
|
||||
// right surface (player console vs SysAdmin console) without a rebuild. gamePort
|
||||
// is the public Minecraft port ([velocity] game_port), which the SPA appends to
|
||||
// the server addresses players copy; 0 or 25565 leaves them bare.
|
||||
func Handler(api http.Handler, rootDomain, panelHost, adminHost string, gamePort int, version string) http.Handler {
|
||||
func Handler(api http.Handler, rootDomain, panelHost, adminHost string, gamePort int, version string, distributed ...bool) http.Handler {
|
||||
files, err := fs.Sub(static, "static")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &handler{
|
||||
api: api,
|
||||
distributed: len(distributed) > 0 && distributed[0],
|
||||
rootDomain: rootDomain,
|
||||
panelHostname: panelHost,
|
||||
adminHostname: adminHost,
|
||||
@@ -143,6 +145,7 @@ func publicGamePort(p int) int {
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
distributed bool
|
||||
api http.Handler
|
||||
rootDomain string
|
||||
panelHostname string
|
||||
@@ -223,6 +226,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
_ = json.NewEncoder(w).Encode(runtimeConfig{
|
||||
APIBase: "/api/v1",
|
||||
Distributed: h.distributed,
|
||||
RootDomain: h.rootDomain,
|
||||
PanelHostname: h.panelHostname,
|
||||
AdminHostname: h.adminHostname,
|
||||
|
||||
Reference in new issue
Block a user