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 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:
containers: backoffLimit: 0
- name: cron template:
image: curlimages/curl:latest spec:
command: restartPolicy: Never
- /bin/sh containers:
- -c - name: curl
- | image: curlimages/curl
echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"startup\"}" command: ["/bin/sh", "-c"]
while true; do args:
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 curl -fsS --max-time 120 -X POST
echo -H "Authorization: Bearer $(cat /etc/secrets/scheduler_key)"
echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"curl end\"}" http://service-seadex-internal:5000/update
sleep 43200 volumeMounts:
done - name: key
mountPath: /etc/secrets
readOnly: true
volumes:
- name: key
secret:
secretName: service-seadex
items:
- key: scheduler_key
path: scheduler_key