swarm-controller: GET/PUT/DELETE /api/agents/{name}/limits
An agent's CPU and memory caps, set from the swarm. Keyed by the agent alone, in a new `agent-limits` KV bucket that swarm-controller alone writes, the same shape as `agent-inference` (#5034): mara on #4268, "agents are not tied to a hive. dont tie the limits to the hive." PUT {"cpu_quota": "400%", "memory_max": "8G"} every field optional, replaces the stored value GET the stored caps, {} when there are none DELETE 204 PUT refuses an agent no hive's wanted state declares (as the inference route does), unknown fields (422), zero and anything systemd does not take, before the queue is asked, and stores memory in the spelling systemd takes (8gb -> 8G). The hive hands these values to systemd verbatim. The routes sit under /api/, behind the swarm UI vhost's authelia subrequest like every sibling; the core-toggle module-eval case pins that gate. The bucket's reader on the hive comes in the next commit. Contributes to #3865.
This commit is contained in:
parent
37f6a845a0
commit
ebeef4b84d
7 changed files with 728 additions and 0 deletions
|
|
@ -286,6 +286,22 @@ let
|
|||
&& !(lib.hasInfix "mint swarmctl" s)
|
||||
&& lib.hasInfix "mint swarm-authelia-bridge" s;
|
||||
}
|
||||
{
|
||||
# swarm-controller checks no caller itself: this location's authelia
|
||||
# subrequest is the operator gate for every route under `/api/`. The
|
||||
# webhook location is the control, the one path to the same socket that
|
||||
# skips the gate, so the first clause reads a string that can lack it.
|
||||
name = "the swarm UI's API location asks authelia before reaching the controller";
|
||||
ok =
|
||||
let
|
||||
l = allLocal.services.nginx.virtualHosts."t.local".locations;
|
||||
socket = allLocal.services.hyperhive.deploy.swarm-controller.socketPath;
|
||||
in
|
||||
lib.hasInfix "auth_request /__hive_authelia;" l."/api/".extraConfig
|
||||
&& lib.hasInfix socket l."/api/".proxyPass
|
||||
&& lib.hasInfix socket l."/webhook/forge/".proxyPass
|
||||
&& !(lib.hasInfix "auth_request" l."/webhook/forge/".extraConfig);
|
||||
}
|
||||
{
|
||||
name = "a hive with matrix off serves no matrix discovery endpoint";
|
||||
ok =
|
||||
|
|
|
|||
Loading…
Reference in a new issue