Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
868c57321c | ||
|
|
b1c828dbf8 |
9 changed files with 72 additions and 19 deletions
|
|
@ -6,6 +6,12 @@
|
||||||
# log in to it, and nothing else. The waits on the store's policy units are
|
# log in to it, and nothing else. The waits on the store's policy units are
|
||||||
# ./glue-bao-readers-policy-order.nix's.
|
# ./glue-bao-readers-policy-order.nix's.
|
||||||
#
|
#
|
||||||
|
# No `Wants=` on the container: it is started by `machines.target` and the
|
||||||
|
# switch's start phase, and a reader's `Wants=` would pull it up mid-switch,
|
||||||
|
# before `activate` has replaced its configuration, on the OLD closure. A
|
||||||
|
# reader that starts before the store costs one failed attempt, retried by
|
||||||
|
# ./lib/store-retry.nix.
|
||||||
|
#
|
||||||
# `Wants=` on `swarm-bao-pki`, not `Requires=`: a pki start that fails or is
|
# `Wants=` on `swarm-bao-pki`, not `Requires=`: a pki start that fails or is
|
||||||
# refused fails each requirer's job with `dependency`, which leaves the reader
|
# refused fails each requirer's job with `dependency`, which leaves the reader
|
||||||
# inactive rather than failed, so its `Restart=on-failure` never fires. Here
|
# inactive rather than failed, so its `Restart=on-failure` never fires. Here
|
||||||
|
|
@ -77,10 +83,7 @@ let
|
||||||
"swarm-bao-pki.service"
|
"swarm-bao-pki.service"
|
||||||
"container@${baoCfg.machine}.service"
|
"container@${baoCfg.machine}.service"
|
||||||
];
|
];
|
||||||
wants = [
|
wants = [ "swarm-bao-pki.service" ];
|
||||||
"swarm-bao-pki.service"
|
|
||||||
"container@${baoCfg.machine}.service"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ let
|
||||||
|
|
||||||
dir = "/run/hyperhive-priv/attic";
|
dir = "/run/hyperhive-priv/attic";
|
||||||
|
|
||||||
|
# Where the store runs on this host, the first login waits for its container.
|
||||||
|
# No `wants`: a pull would start the container mid-switch on the old closure.
|
||||||
|
storeContainer = lib.optional baoDeploy.enable "container@${baoCfg.machine}.service";
|
||||||
|
|
||||||
storeRetry = import ./lib/store-retry.nix { };
|
storeRetry = import ./lib/store-retry.nix { };
|
||||||
storeRefreshTimer = import ./lib/store-refresh-timer.nix { };
|
storeRefreshTimer = import ./lib/store-refresh-timer.nix { };
|
||||||
in
|
in
|
||||||
|
|
@ -62,7 +66,8 @@ in
|
||||||
after = [
|
after = [
|
||||||
"network-online.target"
|
"network-online.target"
|
||||||
"systemd-tmpfiles-setup.service"
|
"systemd-tmpfiles-setup.service"
|
||||||
];
|
]
|
||||||
|
++ storeContainer;
|
||||||
path = [
|
path = [
|
||||||
baoDeploy.package
|
baoDeploy.package
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ let
|
||||||
|
|
||||||
credentialFile = "/run/credstore/${hyperhiveCfg.deploy.hive-controller.squid.selfcheck.credentialName}";
|
credentialFile = "/run/credstore/${hyperhiveCfg.deploy.hive-controller.squid.selfcheck.credentialName}";
|
||||||
|
|
||||||
|
# Where the store runs on this host, the first login waits for its container.
|
||||||
|
# No `wants`: a pull would start the container mid-switch on the old closure.
|
||||||
|
storeContainer = lib.optional baoDeploy.enable "container@${baoCfg.machine}.service";
|
||||||
|
|
||||||
storeRetry = import ./lib/store-retry.nix { };
|
storeRetry = import ./lib/store-retry.nix { };
|
||||||
storeRefreshTimer = import ./lib/store-refresh-timer.nix { };
|
storeRefreshTimer = import ./lib/store-refresh-timer.nix { };
|
||||||
in
|
in
|
||||||
|
|
@ -43,7 +47,8 @@ in
|
||||||
after = [
|
after = [
|
||||||
"network-online.target"
|
"network-online.target"
|
||||||
"systemd-tmpfiles-setup.service"
|
"systemd-tmpfiles-setup.service"
|
||||||
];
|
]
|
||||||
|
++ storeContainer;
|
||||||
path = [
|
path = [
|
||||||
baoDeploy.package
|
baoDeploy.package
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,6 @@ in
|
||||||
"swarm-bao-hive-leaf-policy.service"
|
"swarm-bao-hive-leaf-policy.service"
|
||||||
"swarm-services-cert.service"
|
"swarm-services-cert.service"
|
||||||
];
|
];
|
||||||
wants = [ "container@${baoCfg.machine}.service" ];
|
|
||||||
path = [
|
path = [
|
||||||
baoDeploy.package
|
baoDeploy.package
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
|
|
@ -661,7 +660,6 @@ in
|
||||||
"swarm-bao-pki.service"
|
"swarm-bao-pki.service"
|
||||||
"swarm-bao-services-issuer-policy.service"
|
"swarm-bao-services-issuer-policy.service"
|
||||||
];
|
];
|
||||||
wants = [ "container@${baoCfg.machine}.service" ];
|
|
||||||
path = servicesCertPath;
|
path = servicesCertPath;
|
||||||
# ./lib/store-retry.nix: the login below fails for as long as the
|
# ./lib/store-retry.nix: the login below fails for as long as the
|
||||||
# store is sealed or down.
|
# store is sealed or down.
|
||||||
|
|
|
||||||
|
|
@ -3122,11 +3122,9 @@ in
|
||||||
"swarm-bao-pki.service"
|
"swarm-bao-pki.service"
|
||||||
"container@${cfg.machine}.service"
|
"container@${cfg.machine}.service"
|
||||||
];
|
];
|
||||||
# `Wants=` pki, for ./glue-bao-readers-store-order.nix's reason.
|
# `Wants=` pki and none on the container, for
|
||||||
wants = [
|
# ./glue-bao-readers-store-order.nix's reasons.
|
||||||
"swarm-bao-pki.service"
|
wants = [ "swarm-bao-pki.service" ];
|
||||||
"container@${cfg.machine}.service"
|
|
||||||
];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [
|
path = [
|
||||||
baoDeploy.package
|
baoDeploy.package
|
||||||
|
|
@ -4136,6 +4134,12 @@ in
|
||||||
containers.${cfg.machine} = {
|
containers.${cfg.machine} = {
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
ephemeral = false;
|
ephemeral = false;
|
||||||
|
|
||||||
|
# The container is `Type=notify`, so its start job waits for OpenBao,
|
||||||
|
# whose first start after a restart takes 60-144 s opening the raft
|
||||||
|
# storage. The 1min default kills it mid-open and every retry is cold.
|
||||||
|
timeoutStartSec = "5min";
|
||||||
|
|
||||||
inherit privateNetwork;
|
inherit privateNetwork;
|
||||||
|
|
||||||
# Only material an operator has to be able to back up crosses the
|
# Only material an operator has to be able to back up crosses the
|
||||||
|
|
|
||||||
|
|
@ -1183,7 +1183,6 @@ in
|
||||||
"container@${baoCfg.machine}.service"
|
"container@${baoCfg.machine}.service"
|
||||||
"swarm-bao-pki.service"
|
"swarm-bao-pki.service"
|
||||||
];
|
];
|
||||||
wants = [ "container@${baoCfg.machine}.service" ];
|
|
||||||
path = [
|
path = [
|
||||||
baoDeploy.package
|
baoDeploy.package
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,8 @@ let
|
||||||
{
|
{
|
||||||
# The store's units exist only on its host. The PKI unit is wanted, never
|
# The store's units exist only on its host. The PKI unit is wanted, never
|
||||||
# required: a refused pki start fails a requirer's job with `dependency`.
|
# required: a refused pki start fails a requirer's job with `dependency`.
|
||||||
|
# The container is waited for, not wanted: a `Wants=` would start it
|
||||||
|
# mid-switch on the old closure.
|
||||||
name = "the hive collector's fetch waits for the store's container and PKI unit only where the store runs here";
|
name = "the hive collector's fetch waits for the store's container and PKI unit only where the store runs here";
|
||||||
ok =
|
ok =
|
||||||
let
|
let
|
||||||
|
|
@ -378,7 +380,7 @@ let
|
||||||
lib.all (n: lib.elem n here.after) (storeUnits hiveOtelAllLocal)
|
lib.all (n: lib.elem n here.after) (storeUnits hiveOtelAllLocal)
|
||||||
&& lib.elem "swarm-bao-pki.service" here.wants
|
&& lib.elem "swarm-bao-pki.service" here.wants
|
||||||
&& !(lib.elem "swarm-bao-pki.service" here.requires)
|
&& !(lib.elem "swarm-bao-pki.service" here.requires)
|
||||||
&& lib.elem "container@${hiveOtelAllLocal.services.hyperhive.swarm.bao.machine}.service" here.wants
|
&& !(lib.elem "container@${hiveOtelAllLocal.services.hyperhive.swarm.bao.machine}.service" here.wants)
|
||||||
&& !(lib.any (n: lib.elem n (elsewhere.after ++ elsewhere.wants ++ elsewhere.requires)) (
|
&& !(lib.any (n: lib.elem n (elsewhere.after ++ elsewhere.wants ++ elsewhere.requires)) (
|
||||||
storeUnits hiveOtelLeaf
|
storeUnits hiveOtelLeaf
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -822,6 +822,42 @@ let
|
||||||
&& !(noIdentity.systemd.services ? squid-selfcheck-credential)
|
&& !(noIdentity.systemd.services ? squid-selfcheck-credential)
|
||||||
&& !(noIdentity.systemd.timers ? squid-selfcheck-credential);
|
&& !(noIdentity.systemd.timers ? squid-selfcheck-credential);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
# Both units log in to the store, so where its container runs here they
|
||||||
|
# start after it, and none of the store's readers wants it: a `Wants=`
|
||||||
|
# would start it mid-switch on the old closure. Controls: the units exist
|
||||||
|
# on `noService`, which reads a store it does not run, and carry no
|
||||||
|
# container there.
|
||||||
|
name = "the cache-facts and squid credential units wait for the store's container, without wanting it, only where it runs here";
|
||||||
|
ok =
|
||||||
|
let
|
||||||
|
ref = "container@swarm-bao.service";
|
||||||
|
waits = u: lib.elem ref u.after && !(lib.elem ref u.wants);
|
||||||
|
names = [
|
||||||
|
"hive-priv-cache-facts"
|
||||||
|
"squid-selfcheck-credential"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
lib.all (n: waits allLocal.systemd.services.${n}) (
|
||||||
|
names
|
||||||
|
++ [
|
||||||
|
"hive-tls-resign"
|
||||||
|
"swarm-services-cert"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
&& lib.all (
|
||||||
|
n:
|
||||||
|
noService.systemd.services ? ${n}
|
||||||
|
&& !(lib.elem ref noService.systemd.services.${n}.after)
|
||||||
|
&& !(lib.elem ref noService.systemd.services.${n}.wants)
|
||||||
|
) names;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# The container is `Type=notify`: its start job lasts as long as
|
||||||
|
# OpenBao's first start, which a 1min limit cuts off mid-open.
|
||||||
|
name = "the store's container is given five minutes to start";
|
||||||
|
ok = lib.hasInfix "TimeoutStartSec=5min" allLocal.systemd.units."container@swarm-bao.service".text;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
name = "hive-priv is told the cache's address by the host's configuration";
|
name = "hive-priv is told the cache's address by the host's configuration";
|
||||||
ok =
|
ok =
|
||||||
|
|
|
||||||
|
|
@ -1239,13 +1239,14 @@ let
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
# Where the store runs here, each reader waits for its container and
|
# Where the store runs here, each reader waits for its container and
|
||||||
# the PKI unit minting the leaf it logs in with, and wants both. It
|
# the PKI unit minting the leaf it logs in with, and wants the PKI unit only:
|
||||||
# never requires the PKI unit: a refused pki start fails a requirer's
|
# a `Wants=` on the container would start it mid-switch on the old closure.
|
||||||
|
# It never requires the PKI unit: a refused pki start fails a requirer's
|
||||||
# job with `dependency`, which its `Restart=on-failure` never retries.
|
# job with `dependency`, which its `Restart=on-failure` never retries.
|
||||||
# Elsewhere neither unit exists. On the store's host without the
|
# Elsewhere neither unit exists. On the store's host without the
|
||||||
# readers, none of them is rendered as a stub. Rosters are counted: an
|
# readers, none of them is rendered as a stub. Rosters are counted: an
|
||||||
# empty one holds vacuously.
|
# empty one holds vacuously.
|
||||||
name = "a store reader waits for and wants the store's container and PKI unit only where the store runs here, and requires neither";
|
name = "a store reader waits for the store's container and PKI unit only where the store runs here, wants only the PKI unit, and requires neither";
|
||||||
ok =
|
ok =
|
||||||
let
|
let
|
||||||
machine = serviceContainersWithCi.services.hyperhive.swarm.bao.machine;
|
machine = serviceContainersWithCi.services.hyperhive.swarm.bao.machine;
|
||||||
|
|
@ -1276,7 +1277,7 @@ let
|
||||||
&& lib.elem "swarm-bao-pki.service" here.${u}.wants
|
&& lib.elem "swarm-bao-pki.service" here.${u}.wants
|
||||||
&& !(lib.any (n: lib.elem n here.${u}.requires) storeUnits)
|
&& !(lib.any (n: lib.elem n here.${u}.requires) storeUnits)
|
||||||
&& lib.elem "container@${machine}.service" here.${u}.after
|
&& lib.elem "container@${machine}.service" here.${u}.after
|
||||||
&& lib.elem "container@${machine}.service" here.${u}.wants;
|
&& !(lib.elem "container@${machine}.service" here.${u}.wants);
|
||||||
namesNoStoreUnit =
|
namesNoStoreUnit =
|
||||||
u:
|
u:
|
||||||
let
|
let
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue