Watch
0
0
Fork
You've already forked hyperhive
0

k8s: the queue's pod mounts the host unit's store in place

This commit is contained in:
atlas 2026-11-23 02:58:52 +01:00 • committed by maia
commit 72d9cf93ef

View file

@ -367,7 +367,7 @@ let
# The xkey exists only at runtime, so the server's config is rendered as
# it starts: always the wrapper, and never the store-rendered settings
# alone, which carry no xkey. `+` so the render may write `runtimeDir`.
name = "the queue's server starts only through the config rendered with its xkey";
name = "the queue's server starts only through the config rendered with its xkey, then takes its store directory back";
ok =
lib.all
(
@ -375,11 +375,17 @@ let
let
c = h.containers.swarm-nats.config;
nats = c.systemd.services.nats.serviceConfig;
pre = nats.ExecStartPre or "";
pre = lib.toList (nats.ExecStartPre or [ ]);
render = lib.head pre;
in
lib.hasSuffix "/bin/nats-server -c /var/lib/nats-callout/nats.conf" nats.ExecStart
&& lib.hasPrefix "+/nix/store/" pre
&& lib.hasSuffix "-swarm-nats-render-config" pre
&& lib.hasPrefix "+/nix/store/" render
&& lib.hasSuffix "-swarm-nats-render-config" render
# Then the store directory goes back to the server's user, which the
# pod, mounting it in place, leaves owned by its own.
&& lib.length pre == 2
&& lib.hasPrefix "+/nix/store/" (lib.elemAt pre 1)
&& lib.hasSuffix "/bin/chown -R nats:nats /var/lib/nats" (lib.elemAt pre 1)
&& !(c.services.nats.settings.authorization.auth_callout ? xkey)
)
[