2025-10-03 14:09:34 +02:00
|
|
|
apiVersion: batch/v1
|
|
|
|
|
kind: CronJob
|
|
|
|
|
metadata:
|
|
|
|
|
name: demo-session-cleanup
|
|
|
|
|
namespace: bakery-ia
|
|
|
|
|
labels:
|
|
|
|
|
app: demo-cleanup
|
|
|
|
|
component: maintenance
|
|
|
|
|
spec:
|
|
|
|
|
schedule: "0 * * * *" # Every hour
|
|
|
|
|
timeZone: "Europe/Madrid"
|
|
|
|
|
successfulJobsHistoryLimit: 3
|
|
|
|
|
failedJobsHistoryLimit: 3
|
|
|
|
|
concurrencyPolicy: Forbid
|
|
|
|
|
jobTemplate:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: demo-cleanup
|
|
|
|
|
spec:
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: demo-cleanup
|
|
|
|
|
spec:
|
|
|
|
|
containers:
|
2025-11-30 16:29:38 +01:00
|
|
|
- name: cleanup-trigger
|
|
|
|
|
image: curlimages/curl:latest
|
2025-10-03 14:09:34 +02:00
|
|
|
command:
|
2025-11-30 16:29:38 +01:00
|
|
|
- sh
|
2025-10-03 14:09:34 +02:00
|
|
|
- -c
|
|
|
|
|
- |
|
2025-11-30 16:29:38 +01:00
|
|
|
echo "Triggering demo session cleanup..."
|
|
|
|
|
response=$(curl -s -w "\n%{http_code}" -X POST http://demo-session-service:8000/api/v1/demo/operations/cleanup)
|
|
|
|
|
http_code=$(echo "$response" | tail -n 1)
|
|
|
|
|
body=$(echo "$response" | sed '$d')
|
|
|
|
|
echo "Response: $body"
|
|
|
|
|
echo "HTTP Status: $http_code"
|
|
|
|
|
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
|
|
|
|
|
echo "Cleanup job enqueued successfully"
|
|
|
|
|
exit 0
|
|
|
|
|
else
|
|
|
|
|
echo "Failed to enqueue cleanup job"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2025-10-03 14:09:34 +02:00
|
|
|
resources:
|
|
|
|
|
requests:
|
2025-11-30 16:29:38 +01:00
|
|
|
memory: "32Mi"
|
|
|
|
|
cpu: "10m"
|
2025-10-03 14:09:34 +02:00
|
|
|
limits:
|
2025-11-30 16:29:38 +01:00
|
|
|
memory: "64Mi"
|
|
|
|
|
cpu: "50m"
|
2025-10-03 14:09:34 +02:00
|
|
|
restartPolicy: OnFailure
|
2025-11-30 16:29:38 +01:00
|
|
|
activeDeadlineSeconds: 30
|