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