Watch
0
0
Fork
You've already forked hyperhive
0

k8s: the controller pod keeps no volume; the state gate goes

This commit is contained in:
atlas 2026-11-23 05:45:57 +01:00 • committed by maia
commit 4ea3b0e10d
2 changed files with 233 additions and 1110 deletions

View file

@ -1,20 +0,0 @@
# The `k8s.freshState` option of a service whose pod keeps state in a volume.
# `name` is the service's key under `services.hyperhive.deploy`. ../k8s/render.nix
# reads it into the pod's state gate.
{ lib }:
name:
lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = ''
With {option}`services.hyperhive.deploy.${name}.runtime` set to `k8s`: let
the pod start on an empty state volume. Off, the pod's first init container
stops it before the service starts and says so, until the volume holds
the `.hyperhive-migrated` marker that `swarmctl migrate` writes after it
copies the host's state in. On, an empty volume gets the marker at once
and the service starts with no state. Set it on a fresh install, which
has no state to lose. A volume that holds files and no marker is refused
either way, since a copy may have been cut off.
'';
}

View file

@ -1,11 +0,0 @@
# `pathsWithin dir paths`: the entries of `paths` that sit under `dir`, relative
# to it. A null entry, and a path elsewhere (or `dir` itself), is left out.
{ lib }:
dir: paths:
lib.concatMap (
path:
let
prefix = "${dir}/";
in
lib.optional (path != null && lib.hasPrefix prefix path) (lib.removePrefix prefix path)
) paths