From ceee856b3c15a35ae75f9fc6bc77220c97463dd1 Mon Sep 17 00:00:00 2001 From: fen Date: Wed, 30 Sep 2026 14:23:25 -0500 Subject: [PATCH] k3s: weekly image-refresh timer (pull floating tags + prune); NFS client support --- modules/k3s/k3s.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/k3s/k3s.nix b/modules/k3s/k3s.nix index 808f261..407672f 100644 --- a/modules/k3s/k3s.nix +++ b/modules/k3s/k3s.nix @@ -24,4 +24,27 @@ "ro" ]; }; + + # Weekly rolling refresh: restart all deployments so floating :latest images + # are re-pulled, then prune dangling images. + systemd.services.image-refresh = { + description = "Pull latest floating images by restarting all deployments, then prune"; + path = [ "/run/current-system/sw/bin" ]; + script = '' + /run/current-system/sw/bin/k3s kubectl rollout restart deployments -A + sleep 120 + /run/current-system/sw/bin/k3s crictl rmi --prune || true + ''; + serviceConfig.Type = "oneshot"; + }; + + systemd.timers.image-refresh = { + description = "Weekly image refresh"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "Sun *-*-* 04:30:00"; + Persistent = true; + RandomizedDelaySec = "10m"; + }; + }; }