diff --git a/service-royalroad-chapters/cron-gitea.yaml b/service-royalroad-chapters/cron-gitea.yaml deleted file mode 100644 index cff516c..0000000 --- a/service-royalroad-chapters/cron-gitea.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: service-royalroad-chapters-cron-gitea - namespace: app-notifications -spec: - serviceName: service-royalroad-chapters-cron-gitea - replicas: 1 - selector: - matchLabels: - app: service-royalroad-chapters-cron - template: - metadata: - labels: - app: service-royalroad-chapters-cron - 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 GET --max-time 150 http://service-royalroad-chapters-internal:5000/gitea - echo - echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"curl end\"}" - sleep 300 - done diff --git a/service-royalroad-chapters/cron-royalroad.yaml b/service-royalroad-chapters/cron-royalroad.yaml deleted file mode 100644 index c3f7940..0000000 --- a/service-royalroad-chapters/cron-royalroad.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: service-royalroad-chapters-cron-royalroad - namespace: app-notifications -spec: - serviceName: service-royalroad-chapters-cron-royalroad - replicas: 1 - selector: - matchLabels: - app: service-royalroad-chapters-cron - template: - metadata: - labels: - app: service-royalroad-chapters-cron - 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 GET --max-time 150 http://service-royalroad-chapters-internal:5000/royalroad - echo - echo "{\"timestamp\":\"$(date '+%Y-%m-%dT%H:%M:%S%z')\",\"event\":\"curl end\"}" - sleep 300 - done diff --git a/service-royalroad-chapters/cron-update-gitea.yaml b/service-royalroad-chapters/cron-update-gitea.yaml new file mode 100644 index 0000000..26946a2 --- /dev/null +++ b/service-royalroad-chapters/cron-update-gitea.yaml @@ -0,0 +1,35 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: seadex-update +spec: + schedule: "30 */6 * * *" + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + 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-royalroad-chapters-internal:5000/gitea + volumeMounts: + - name: key + mountPath: /etc/secrets + readOnly: true + volumes: + - name: key + secret: + secretName: service-royalroad-chapters + items: + - key: scheduler_key + path: scheduler_key diff --git a/service-royalroad-chapters/cron-update-royalroad.yaml b/service-royalroad-chapters/cron-update-royalroad.yaml new file mode 100644 index 0000000..5387ac1 --- /dev/null +++ b/service-royalroad-chapters/cron-update-royalroad.yaml @@ -0,0 +1,35 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: royalroad-chapters-update-rr +spec: + schedule: "5-59/10 * * * *" + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + 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-royalroad-chapters-internal:5000/royalroad + volumeMounts: + - name: key + mountPath: /etc/secrets + readOnly: true + volumes: + - name: key + secret: + secretName: service-royalroad-chapters + items: + - key: scheduler_key + path: scheduler_key