chore(snapshot): sync workspace state

This commit is contained in:
mpabi
2026-03-29 13:14:30 +02:00
parent 71b00f80bb
commit 4354de5c83
46 changed files with 959 additions and 5718 deletions

View File

@@ -0,0 +1,63 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dlob-redis-retention
data:
clean.sh: |
#!/bin/sh
set -eu
now_s="$(date +%s)"
for pattern in 'dlob-hot:*' 'dlob-all:*'; do
max_age_s=900
if [ "$pattern" = 'dlob-all:*' ]; then
max_age_s=3600
fi
for key in $(redis-cli -h dlob-redis --scan --pattern "$pattern"); do
value="$(redis-cli -h dlob-redis --raw get "$key" || true)"
ts="$(printf '%s' "$value" | sed -n 's/.*"ts":\([0-9][0-9]*\).*/\1/p')"
if [ -z "$ts" ]; then
ts="$(printf '%s' "$value" | sed -n 's/.*"updatedAtTs":\([0-9][0-9]*\).*/\1/p')"
fi
[ -n "$ts" ] || continue
if [ $((now_s - ts / 1000)) -gt "$max_age_s" ]; then
redis-cli -h dlob-redis del "$key" >/dev/null
fi
done
done
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: dlob-redis-retention
spec:
schedule: "*/5 * * * *"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: cleaner
image: redis:7-alpine
command:
- /bin/sh
- /scripts/clean.sh
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: script
mountPath: /scripts
volumes:
- name: script
configMap:
name: dlob-redis-retention
defaultMode: 365