Changed from pod based Cron job back to Kubernetes CronJob because it now needs an API key

This commit is contained in:
florian committed 2026-10-29 19:15:32 +01:00
1 parent 5c0daab524
commit 6982b31ad1
1 file changed
+32 -28
+32 -28
View File
@@ -1,31 +1,35 @@
apiVersion: apps/v1
kind: StatefulSet
apiVersion: batch/v1
kind: CronJob
metadata:
name: service-seadex-cron
namespace: app-notifications
name: seadex-update
spec:
serviceName: service-seadex-cron
replicas: 1
selector:
matchLabels:
app: service-seadex-cron
template:
metadata:
labels:
app: service-seadex-cron
schedule: "11 */6 * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
containers:
- name: cron
image: curlimages/curl:latest
command:
- /bin/sh
- -c
- |
echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"startup\"}"
while true; do
echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"curl start\"}"
curl -s -X POST --max-time 150 http://service-seadex-internal:5000/update
echo
echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"curl end\"}"
sleep 43200
done
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: curl
image: curlimages/curl
command: ["/bin/sh", "-c"]
args:
- >
curl -fsS --max-time 120 -X POST
-H "Authorization: Bearer $(cat /etc/secrets/scheduler_key)"
http://service-seadex-internal:5000/update
volumeMounts:
- name: key
mountPath: /etc/secrets
readOnly: true
volumes:
- name: key
secret:
secretName: service-seadex
items:
- key: scheduler_key
path: scheduler_key