From 10e323132c047ccd74c55bfc49139d22665a02af Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sun, 27 Sep 2026 11:24:49 +0200 Subject: [PATCH] Let a control plane whose models all live in the database start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Control plane mode was inferred from the config file alone: a model with profiles meant "control plane", nothing meant "router only". So a deployment that manages its catalog at runtime could not start at all — the file declares no models, the process refuses for want of anything to serve, and the stored models it would have loaded are never read. A cluster unmanageable at runtime because it is managed at runtime. control.enabled says so outright. AgentListen cannot carry the signal: it has a default, so every deployment would silently become a control plane. The inference stays, so nothing already working has to add a flag. Co-Authored-By: Claude Opus 5 (1M context) --- docs/reference.md | 16 ++++++++++++++++ internal/config/config.go | 15 +++++++++++++++ internal/config/config_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/docs/reference.md b/docs/reference.md index 4e81d728..183b0525 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -65,6 +65,7 @@ rather than repeated. | `lost_after` | `time.Duration` | [Control](#control) | | `port_range` | `[]int` | [Control](#control) | | `mgmt_interface` | `string` | [Control](#control) | +| `enabled` | `bool` | [Control](#control) | | `lease_ttl` | `time.Duration` | [Control](#control) | | `id` | `string` | [Endpoint](#endpoint) | | `url` | `string` | [Endpoint](#endpoint) | @@ -485,6 +486,21 @@ PortRange is the per-node range for engine HTTP and dist-init ports. MgmtInterface is the ethernet interface NCCL bootstraps over. +### `enabled` + +`bool` + +Enabled runs the control plane even when configuration declares no +models. + +Without it, a deployment whose catalog lives entirely in the database +cannot start: control plane mode is inferred from the config file, so an +empty models block means "router only", the process refuses to start for +want of anything to serve, and the models it would have loaded are never +read. That is a cluster that cannot be managed at runtime because it is +managed at runtime. AgentListen cannot carry this signal — it has a +default, so every deployment would become a control plane. + ### `lease_ttl` `time.Duration` diff --git a/internal/config/config.go b/internal/config/config.go index 7cf87487..2292f1e7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -208,6 +208,18 @@ type Control struct { // MgmtInterface is the ethernet interface NCCL bootstraps over. MgmtInterface string `koanf:"mgmt_interface"` + // Enabled runs the control plane even when configuration declares no + // models. + // + // Without it, a deployment whose catalog lives entirely in the database + // cannot start: control plane mode is inferred from the config file, so an + // empty models block means "router only", the process refuses to start for + // want of anything to serve, and the models it would have loaded are never + // read. That is a cluster that cannot be managed at runtime because it is + // managed at runtime. AgentListen cannot carry this signal — it has a + // default, so every deployment would become a control plane. + Enabled bool `koanf:"enabled"` + // LeaseTTL is how long this control plane's claim to be the one placing // work stands without being renewed. // @@ -492,6 +504,9 @@ func (s Server) Catalog() (*catalog.Catalog, error) { // plus a static endpoint list is the router-only mode used for testing against // sim-engines. func (s Server) ControlPlaneMode() bool { + if s.Control.Enabled { + return true + } for _, m := range s.Models { if len(m.Profiles) > 0 { return true diff --git a/internal/config/config_test.go b/internal/config/config_test.go index e448bb9a..0cba22e5 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -154,3 +154,31 @@ func TestValidateAcceptsDistinctAliases(t *testing.T) { t.Errorf("valid aliases rejected: %v", err) } } + +func TestAControlPlaneCanBeAskedForWithNoModelsInTheFile(t *testing.T) { + // Without this, a deployment whose catalog lives entirely in the database + // cannot start: the mode is inferred from the file, an empty models block + // reads as "router only", and the process refuses to start for want of + // anything to serve — so the stored models it would have loaded are never + // read at all. + var s Server + if s.ControlPlaneMode() { + t.Fatal("an empty configuration is not a control plane") + } + s.Control.Enabled = true + if !s.ControlPlaneMode() { + t.Error("control.enabled should run the control plane with no models declared") + } +} + +func TestAModelWithProfilesStillMakesAControlPlane(t *testing.T) { + // The inference stays, so no existing configuration has to add a flag. + var s Server + s.Models = []catalog.Model{{ + Name: "m", + Profiles: []catalog.Profile{{Name: "p", Engine: "llamacpp"}}, + }} + if !s.ControlPlaneMode() { + t.Error("a declared model with profiles is still a control plane") + } +}