k8s: the queue's pod mounts the host unit's store in place
This commit is contained in:
parent
658c7fe384
commit
72d9cf93ef
2 changed files with 267 additions and 155 deletions
|
|
@ -20,7 +20,6 @@ let
|
|||
deployCfg = config.services.hyperhive.deploy;
|
||||
node = deployCfg.k8s;
|
||||
controllerCfg = deployCfg.swarm-controller;
|
||||
natsCfg = deployCfg.nats;
|
||||
|
||||
# The path of a unit's state directory in a pod, which ./render.nix mounts
|
||||
# the claim at.
|
||||
|
|
@ -31,11 +30,11 @@ let
|
|||
controllerStateDir = "/var/lib/swarm-controller";
|
||||
|
||||
# `option` is the service's name under `services.hyperhive.deploy`. `state`
|
||||
# is null for a service whose pod keeps nothing worth moving: no volume, an
|
||||
# `emptyDir`, or a volume that starts empty with no gate.
|
||||
# is null for a service with nothing to copy: no volume, an `emptyDir`, a
|
||||
# volume that starts empty with no gate, or (the queue) the host unit's own
|
||||
# directory, mounted into the pod.
|
||||
#
|
||||
# The claim is `<service>-state`, as ./render.nix and ../swarm-nats.nix name
|
||||
# it.
|
||||
# The claim is `<service>-state`, as ./render.nix names it.
|
||||
stateTable = {
|
||||
swarm-controller = {
|
||||
option = "swarm-controller";
|
||||
|
|
@ -52,11 +51,7 @@ let
|
|||
};
|
||||
swarm-nats = {
|
||||
option = "nats";
|
||||
state = {
|
||||
mount = natsCfg.storeDir;
|
||||
hostPath = "/var/lib/nixos-containers/swarm-nats${natsCfg.storeDir}";
|
||||
excludes = [ ];
|
||||
};
|
||||
state = null;
|
||||
};
|
||||
swarm-notify-router = {
|
||||
option = "notify-router";
|
||||
|
|
|
|||
|
|
@ -169,8 +169,7 @@ let
|
|||
# a pod holds more than the daemon, a function of the daemon's container
|
||||
# (its environment, mounts and security context) giving the rest: further
|
||||
# containers, init containers, volumes, host aliases, pod settings, objects and
|
||||
# images, and `state`, the `volume` and mount `path` of a state volume the
|
||||
# pod makes itself, which the state gate checks. An `otlp` of `"none"` is a daemon that pushes no telemetry of its
|
||||
# and images. An `otlp` of `"none"` is a daemon that pushes no telemetry of its
|
||||
# own.
|
||||
services = {
|
||||
swarm-controller = {
|
||||
|
|
@ -213,7 +212,6 @@ let
|
|||
etcFiles = [ ];
|
||||
publicCredentials."bao-ca.pem" = baoServerCaKey;
|
||||
otlp = "none";
|
||||
fresh = freshOf "nats" natsCfg;
|
||||
switch = {
|
||||
inherit (natsCfg) runtime;
|
||||
hostUnit = "container@swarm-nats.service";
|
||||
|
|
@ -779,21 +777,15 @@ let
|
|||
bin = leafIssueBin;
|
||||
};
|
||||
# The volume the state gate checks, and where it is mounted: that of a
|
||||
# service with a `fresh` option, none for the rest. A pod that makes its
|
||||
# own volume names it in `state`.
|
||||
# service with a `fresh` option, none for the rest.
|
||||
stateVolume =
|
||||
if !(svc ? fresh) then
|
||||
null
|
||||
if svc ? fresh && stateDir != null then
|
||||
{
|
||||
volume = "state";
|
||||
path = stateDir;
|
||||
}
|
||||
else
|
||||
extra.state or (
|
||||
if stateDir != null then
|
||||
{
|
||||
volume = "state";
|
||||
path = stateDir;
|
||||
}
|
||||
else
|
||||
null
|
||||
);
|
||||
null;
|
||||
|
||||
stateGate = lib.optionalAttrs (stateVolume != null) {
|
||||
name = "state-gate";
|
||||
|
|
|
|||
Loading…
Reference in a new issue