hyperhive: make the values the meta-flake render reads swarm-wide
Five host options whose values hive-c0re renders into every agent's build move under services.hyperhive.swarm, so the swarm states each of them once instead of every hive carrying its own copy: c0re.dashboardPort -> swarm.dashboardPort c0re.claudeCodePackage -> swarm.claudeCodePackage github.enable -> swarm.github.enable otel.collector.port -> swarm.hiveOtel.collectorPort otel.extraResourceAttributes -> swarm.hiveOtel.extraResourceAttributes Every old path is a mkRenamedOptionModule alias, so a host that sets one keeps its value and gets an eval warning naming the new path. Types and defaults are unchanged, so the rendered meta flake, serve.json and hive-c0re's environment are the same as before on a host that sets none of them. The readers move with them: serve.json and its gc-root assertion, the hive-c0re environment, the hive collector's listen address and bridge port, the swarm collector's port-collision assertion, and the claude-login and review-classifier containers' claude pin. The swarm-services-switch fixture sets the swarm path and now also checks that serve.json carries the pinned claude. Part of #4857 (slice 2).
This commit is contained in:
parent
af7114eb49
commit
fc32f57481
25 changed files with 189 additions and 138 deletions
|
|
@ -57,6 +57,14 @@ in
|
|||
hostUnit = true;
|
||||
enable = config.services.hyperhive.otel.enable;
|
||||
})
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "otel" "collector" "port" ]
|
||||
[ "services" "hyperhive" "swarm" "hiveOtel" "collectorPort" ]
|
||||
)
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "otel" "extraResourceAttributes" ]
|
||||
[ "services" "hyperhive" "swarm" "hiveOtel" "extraResourceAttributes" ]
|
||||
)
|
||||
];
|
||||
|
||||
options.services.hyperhive.otel = {
|
||||
|
|
@ -147,17 +155,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
extraResourceAttributes = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "deployment.environment=prod";
|
||||
description = ''
|
||||
Extra comma-separated entries appended to
|
||||
`OTEL_RESOURCE_ATTRIBUTES` after the built-in
|
||||
`service.name` / `agent` / `hive` / `swarm` labels.
|
||||
'';
|
||||
};
|
||||
|
||||
collector.upstreamHeaderName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Authorization";
|
||||
|
|
@ -178,21 +175,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
collector.port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 4318;
|
||||
description = ''
|
||||
Port the collector's OTLP/HTTP receiver listens on, at
|
||||
`services.hyperhive.network.bridgeIp`. 4318 is the OTLP/HTTP
|
||||
default.
|
||||
|
||||
The port is contributed to
|
||||
`services.hyperhive.network.exposeHostPorts`, which opens it on
|
||||
the bridge interface only — so it is reachable from agent
|
||||
containers and not from the outside world.
|
||||
'';
|
||||
};
|
||||
|
||||
collector.host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
|
|
@ -296,14 +278,46 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# Shared by every hive's otel tier and its agents, so an agent's build
|
||||
# carries the same values whichever hive renders it.
|
||||
options.services.hyperhive.swarm.hiveOtel = {
|
||||
collectorPort = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 4318;
|
||||
description = ''
|
||||
Port of every hive collector's OTLP/HTTP receiver, at that hive's
|
||||
`services.hyperhive.network.bridgeIp`: the port agents dial at
|
||||
`services.hyperhive.otel.collector.host`. 4318 is the OTLP/HTTP
|
||||
default.
|
||||
|
||||
The port is contributed to
|
||||
`services.hyperhive.network.exposeHostPorts`, which opens it on
|
||||
the bridge interface only — so it is reachable from agent
|
||||
containers and not from the outside world.
|
||||
'';
|
||||
};
|
||||
|
||||
extraResourceAttributes = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "deployment.environment=prod";
|
||||
description = ''
|
||||
Extra comma-separated entries appended to
|
||||
`OTEL_RESOURCE_ATTRIBUTES` after the built-in
|
||||
`service.name` / `agent` / `hive` / `swarm` labels.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.hyperhive.otel.enable (
|
||||
let
|
||||
otel = config.services.hyperhive.otel;
|
||||
autheliaCfg = config.services.hyperhive.swarm.authelia;
|
||||
deployCfg = config.services.hyperhive.deploy;
|
||||
swarmOtelCfg = config.services.hyperhive.swarm.otel;
|
||||
hiveOtelCfg = config.services.hyperhive.swarm.hiveOtel;
|
||||
hiveName = config.services.hyperhive.hiveName;
|
||||
listen = "${config.services.hyperhive.network.bridgeIp}:${toString otel.collector.port}";
|
||||
listen = "${config.services.hyperhive.network.bridgeIp}:${toString hiveOtelCfg.collectorPort}";
|
||||
swarmName = "otlphttp/swarm";
|
||||
gatewayCfg = config.services.hyperhive.gateway;
|
||||
authName = "oauth2client/swarm";
|
||||
|
|
@ -351,7 +365,7 @@ in
|
|||
{
|
||||
# Reachable from agent containers and nowhere else: this opens
|
||||
# the port on the bridge interface only.
|
||||
services.hyperhive.network.exposeHostPorts = [ otel.collector.port ];
|
||||
services.hyperhive.network.exposeHostPorts = [ hiveOtelCfg.collectorPort ];
|
||||
|
||||
# The name agents dial, answered with the bridge IP the receiver binds.
|
||||
services.hyperhive.gateway.localNames = [ otel.collector.host ];
|
||||
|
|
|
|||
Loading…
Reference in a new issue