pin queue and poller state to per-service node labels instead of the hostname
This commit is contained in:
parent
ab6a180e79
commit
79c06cdcb0
1 changed files with 348 additions and 40 deletions
|
|
@ -61,6 +61,10 @@ let
|
|||
|
||||
onK8s = cfg.runtime == "k8s";
|
||||
|
||||
# Where the host unit's `StateDirectory` is: `DynamicUser` keeps it under
|
||||
# `/var/lib/private`, so the pod's volume is the directory the unit uses.
|
||||
hostStateDir = "/var/lib/private/${unit}";
|
||||
|
||||
# `hostUnit`: a host service, so the bundle reads the host CA path and waits
|
||||
# on `hive-tls-ca.service`. `enable`: `imports` is unconditional, so without
|
||||
# it a host with the poller off gets the bundle unit and an `ExecStart`-less
|
||||
|
|
@ -209,16 +213,28 @@ in
|
|||
configuration must enable. A switch moves the poller: the service and
|
||||
timer go and the CronJob is applied, or the CronJob is deleted and the
|
||||
service and timer return, so one poller runs at any time. Its cursor is
|
||||
in the service's state directory on the host, and in a volume of the
|
||||
cluster in a pod; neither moves with the poller, so the first pass after
|
||||
a switch pushes every run again, as the same points. The pod starts on
|
||||
its empty volume with no gate.
|
||||
in the service's state directory on the host, and the cluster's volume
|
||||
for it is on that directory, so a switch moves the process and not the
|
||||
cursor. The pod runs on the node with the
|
||||
`hyperhive.darkest.space/state-ci-metrics` label, which the node
|
||||
module sets, and starts with no gate.
|
||||
|
||||
The poller keeps pushing to the swarm collector's route of its own,
|
||||
not to the hive collector the cluster's other pods push to.
|
||||
'';
|
||||
};
|
||||
|
||||
hostStateDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
internal = true;
|
||||
default = hostStateDir;
|
||||
description = ''
|
||||
The directory the poller's service keeps its cursor in on the host,
|
||||
which the cluster's volume for it is on (./k8s/render.nix).
|
||||
'';
|
||||
};
|
||||
|
||||
unit = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
readOnly = true;
|
||||
|
|
@ -287,6 +303,14 @@ in
|
|||
# name, which the cluster resolves to the hive bridge.
|
||||
(lib.mkIf (cfg.enable && onK8s) {
|
||||
services.hyperhive.network.enable = lib.mkDefault true;
|
||||
|
||||
# The pod's local volume needs its directory to exist before the pod
|
||||
# starts, which on a host that never ran the service nothing else makes.
|
||||
# The parent is the one the service manager makes for a dynamic user.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/private 0700 root root -"
|
||||
"d ${hostStateDir} 0700 root root -"
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue