cluster/services/storage: register existing keys and buckets in incandescence

This commit is contained in:
Max Headroom 2024-08-12 02:34:35 +02:00
parent 25d696f4eb
commit f8d37fd8c4
2 changed files with 19 additions and 0 deletions

View file

@ -39,6 +39,7 @@ in
./garage.nix ./garage.nix
./garage-options.nix ./garage-options.nix
./garage-layout.nix ./garage-layout.nix
./incandescence-ascensions.nix
] ++ lib.optionals config.simulacrum [ ] ++ lib.optionals config.simulacrum [
./simulacrum/snakeoil-rpc-secret.nix ./simulacrum/snakeoil-rpc-secret.nix
]; ];

View file

@ -0,0 +1,18 @@
{ config, lib, ... }:
{
system.ascensions = {
incandescence-garage = lib.mkIf (config.services.incandescence.providers ? garage) {
incantations = i: [
(i.runGarage /*bash*/ ''
garage bucket list | tail -n +2 | cut -d' ' -f3 | while read bucket; do
${i.runConsul /*bash*/ ''consul kv put "services/incandescence/providers/garage/formulae/bucket/$1/alive" true''} "$bucket"
done
garage key list | tail -n +2 | cut -d' ' -f5 | while read key; do
${i.runConsul /*bash*/ ''consul kv put "services/incandescence/providers/garage/formulae/key/$1/alive" true''} "$key"
done
'')
];
};
};
}