From 6982b31ad140c344afe9ef888fcb43e324dc2a90 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 29 Oct 2026 19:15:32 +0100 Subject: [PATCH] Changed from pod based Cron job back to Kubernetes CronJob because it now needs an API key --- service-seadex/cron-update.yaml | 60 ++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/service-seadex/cron-update.yaml b/service-seadex/cron-update.yaml index 8ea48e3..db8b4a1 100644 --- a/service-seadex/cron-update.yaml +++ b/service-seadex/cron-update.yaml @@ -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