move the small per-service host options to deploy.<service>
This commit is contained in:
parent
400fdd7f0e
commit
525de62b06
1 changed files with 407 additions and 251 deletions
|
|
@ -193,8 +193,8 @@ let
|
|||
# didn't need to; the assertions cover the split case so nobody gets a
|
||||
# daemon that silently never connects.
|
||||
queueEnv = {
|
||||
SWARM_CONTROLLER_NATS_URL = cfg.queue.natsUrl;
|
||||
SWARM_CONTROLLER_OIDC_TOKEN_ENDPOINT = cfg.queue.tokenEndpoint;
|
||||
SWARM_CONTROLLER_NATS_URL = deployCfg.swarm-controller.queue.natsUrl;
|
||||
SWARM_CONTROLLER_OIDC_TOKEN_ENDPOINT = deployCfg.swarm-controller.queue.tokenEndpoint;
|
||||
SWARM_CONTROLLER_OIDC_CLIENT_ID = queueClientId;
|
||||
};
|
||||
|
||||
|
|
@ -391,39 +391,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
queue = {
|
||||
natsUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "tls://${natsCfg.domain}:${toString natsCfg.port}";
|
||||
defaultText = lib.literalExpression ''"tls://''${swarm.nats.domain}:''${swarm.nats.port}"'';
|
||||
example = "tls://nats.example.com:4222";
|
||||
description = ''
|
||||
Where the controller reaches the swarm queue.
|
||||
|
||||
Defaults to the queue's name, which is the same URL on every
|
||||
host: the queue's own host resolves it locally, and any other
|
||||
through the operator's DNS.
|
||||
|
||||
Empty means unset, which the assertion below refuses — a
|
||||
controller with no queue is not a lighter controller.
|
||||
'';
|
||||
};
|
||||
|
||||
tokenEndpoint = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${autheliaCfg.url}/api/oidc/token";
|
||||
defaultText = lib.literalExpression ''"''${swarm.authelia.url}/api/oidc/token"'';
|
||||
description = ''
|
||||
The OIDC token endpoint the controller mints its own access
|
||||
token from.
|
||||
|
||||
Derived from `swarm.authelia.url`, which is the half of the
|
||||
authelia module that exists on every host — so this is already
|
||||
correct for a remote provider as long as that URL is set.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
links = lib.mkOption {
|
||||
type = lib.types.listOf (
|
||||
lib.types.submodule {
|
||||
|
|
@ -483,6 +450,39 @@ in
|
|||
# the latter is hive-c0re's namespace, where `tls.*` lives. A definition on
|
||||
# the wrong one lands on a live, unrelated option rather than failing.
|
||||
options.services.hyperhive.deploy.swarm-controller = {
|
||||
queue = {
|
||||
natsUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "tls://${natsCfg.domain}:${toString natsCfg.port}";
|
||||
defaultText = lib.literalExpression ''"tls://''${swarm.nats.domain}:''${swarm.nats.port}"'';
|
||||
example = "tls://nats.example.com:4222";
|
||||
description = ''
|
||||
Where the controller reaches the swarm queue.
|
||||
|
||||
Defaults to the queue's name, which is the same URL on every
|
||||
host: the queue's own host resolves it locally, and any other
|
||||
through the operator's DNS.
|
||||
|
||||
Empty means unset, which the assertion below refuses — a
|
||||
controller with no queue is not a lighter controller.
|
||||
'';
|
||||
};
|
||||
|
||||
tokenEndpoint = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${autheliaCfg.url}/api/oidc/token";
|
||||
defaultText = lib.literalExpression ''"''${swarm.authelia.url}/api/oidc/token"'';
|
||||
description = ''
|
||||
The OIDC token endpoint the controller mints its own access
|
||||
token from.
|
||||
|
||||
Derived from `swarm.authelia.url`, which is the half of the
|
||||
authelia module that exists on every host — so this is already
|
||||
correct for a remote provider as long as that URL is set.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
defaultText = lib.literalExpression "hyperhive.packages.\${system}.swarm-controller";
|
||||
|
|
@ -558,7 +558,7 @@ in
|
|||
|
||||
No new credential to configure: the bearer token presented to
|
||||
the bridge is minted from THIS daemon's own existing queue OIDC
|
||||
identity — its endpoints stay in `swarm.controller.queue`, its secret is
|
||||
identity — its endpoints stay in `deploy.swarm-controller.queue`, its secret is
|
||||
read from the swarm's secret store — "one identity per principal"
|
||||
already covers it. `null` means no agent-identity support:
|
||||
`CreateIdentity` jobs fail with a clear "no auth bridge
|
||||
|
|
@ -696,18 +696,18 @@ in
|
|||
# because on an all-local deployment nothing was wrong.
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.queue.natsUrl != "";
|
||||
assertion = deployCfg.swarm-controller.queue.natsUrl != "";
|
||||
message = ''
|
||||
services.hyperhive.swarm.controller.queue.natsUrl is unset.
|
||||
services.hyperhive.deploy.swarm-controller.queue.natsUrl is unset.
|
||||
|
||||
It defaults to the queue's name; something in this configuration
|
||||
set it to "". Remove that setting, or set the URL.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.queue.tokenEndpoint != "";
|
||||
assertion = deployCfg.swarm-controller.queue.tokenEndpoint != "";
|
||||
message = ''
|
||||
services.hyperhive.swarm.controller.queue.tokenEndpoint is unset.
|
||||
services.hyperhive.deploy.swarm-controller.queue.tokenEndpoint is unset.
|
||||
|
||||
It defaults from services.hyperhive.swarm.authelia.url, so this
|
||||
only happens when it has been cleared by hand. The controller
|
||||
|
|
|
|||
Loading…
Reference in a new issue