Changed from pod based Cron job back to Kubernetes CronJob because it now needs an API key
This commit is contained in:
1 parent
df24ecc08e
commit
1fb4a2f7d5
4 files changed
+70
-62
No files matched your search
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in new issue
Block a user