Skip to content

feat(controller): add environments, groups and placement to the pool model - #48

Merged
TheMeinerLP merged 5 commits into
mainfrom
feat/v2-core-resolve
Nov 25, 2026
Merged

TheMeinerLP merged 5 commits into
mainfrom
feat/v2-core-resolve

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Problem

A pool could only describe one way of running a server: inline image, command and driver. Operators who run the same server software in many pools had to repeat it everywhere, a pool could not say where it runs besides a single driver switch, and nothing marked who owns a declaration, so a later Kubernetes CRD source would have fought with the API over the same objects. Proxies also had no way to ask for the network-wide player count.

Approach

  • Environments (how a service runs) and groups (shared templates, env, labels) are new declarations next to pools, available under /v1/environments and /v1/groups. A pool names an environment and groups and gets a merged effective spec; the old inline fields and the v1 driver keep working unchanged when no environment is named. A pool can also state its placement (kubernetes, agent with a host, process).
  • Every declaration carries a source (api, kubernetes, file). Objects owned by Kubernetes are read-only through the API (409), while the Kubernetes source can change them through a separate applier interface that the CRD watcher will use.
  • A pool that names an unknown environment or group starts nothing and reports it once as a pool.condition event instead of failing every reconcile cycle.
  • The controller sums the players of Ready and Allocated proxies, serves them on GET /v1/network and publishes network.players when the sum changes.
  • Sharding and private-server fields exist in the spec only; their behaviour comes later. The router driver, agent, CRD watcher, S3 store and CLI are separate work.

Testing

Table-driven tests for the merge rules and validation, store tests on temp SQLite files, controller tests with the fake driver and a fake clock (start with effective spec, unknown references, ownership guard, network events), driver tests for the effective-spec path, and API tests. go build, go vet, gofmt and go test ./... pass locally; openapi.yaml is regenerated and its sync test passes.

…esolution

Environment and Group are new declarations next to Pool, each with a
source (api, kubernetes, file). PoolSpec gains environment, groups,
placement, sharding and private; the v1 driver field keeps working as
placement.driver. ResolvePool merges pool, environment and groups into
the spec a driver runs.
Adds a goose migration with environments and groups tables and a
source column on pools. Pools stored before the migration are owned by
the api.
…layers

Pools can now name an environment and groups; instances start with
the merged spec and drivers read it with a fallback to the v1 fields.
A pool that names something unknown starts nothing and reports a
pool.condition event once. The kubernetes source owns what it applies
and the api gets ErrManagedElsewhere for those objects. The controller
sums proxy players and publishes network.players on change.
Adds GET/PUT/DELETE for /v1/environments and /v1/groups under the
pools scopes and GET /v1/network under players:read, which proxies
already hold. Kubernetes-owned objects answer 409. openapi.yaml is
regenerated.
@TheMeinerLP
TheMeinerLP merged commit 0b14fcd into main Nov 25, 2026
5 checks passed
@TheMeinerLP
TheMeinerLP deleted the feat/v2-core-resolve branch November 25, 2026 09:35
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.

1 participant