diff --git a/services/maintenance/node-image-sweeper-script.yaml b/services/maintenance/node-image-sweeper-script.yaml index 76553a1..6e3b02c 100644 --- a/services/maintenance/node-image-sweeper-script.yaml +++ b/services/maintenance/node-image-sweeper-script.yaml @@ -17,7 +17,11 @@ data: THRESHOLD_DAYS=3 fi - cutoff=$(date -d "${THRESHOLD_DAYS} days ago" +%s 2>/dev/null || date -v -"${THRESHOLD_DAYS}"d +%s) + cutoff=$(python3 - <<'PY' + import time, os + print(int(time.time()) - int(os.environ.get("THRESHOLD_DAYS", "14")) * 86400) + PY + ) RUNNING=$(chroot /host /bin/sh -c "crictl ps -a --quiet 2>/dev/null" | tr -s ' ' '\n' | sort -u | tr '\n' ' ') IMAGES_JSON=$(chroot /host /bin/sh -c "crictl images -o json 2>/dev/null" || echo '{}')