a pod with a state volume starts only on a migrated or fresh volume
This commit is contained in:
parent
7a7491a85a
commit
7e15cd492b
1 changed files with 175 additions and 46 deletions
20
nix/host-modules/lib/fresh-state-option.nix
Normal file
20
nix/host-modules/lib/fresh-state-option.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# 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.
|
||||
'';
|
||||
}
|
||||
Loading…
Reference in a new issue