mastodon-bot as cron
This commit is contained in:
parent
54cb0ac9e7
commit
ab1621a0ec
4 changed files with 42 additions and 4 deletions
|
@ -19,8 +19,10 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
(defn generate-deployment []
|
(defn generate-deployment []
|
||||||
(->
|
(yaml/from-string (yaml/load-resource "deployment.yaml")))
|
||||||
(yaml/from-string (yaml/load-resource "deployment.yaml"))))
|
|
||||||
|
(defn generate-cron []
|
||||||
|
(yaml/from-string (yaml/load-resource "cron.yaml")))
|
||||||
|
|
||||||
(defn-spec generate any?
|
(defn-spec generate any?
|
||||||
[my-config string?
|
[my-config string?
|
||||||
|
@ -28,4 +30,4 @@
|
||||||
(cs/join "\n"
|
(cs/join "\n"
|
||||||
[(yaml/to-string (generate-config my-config my-auth))
|
[(yaml/to-string (generate-config my-config my-auth))
|
||||||
"---"
|
"---"
|
||||||
(yaml/to-string (generate-deployment))]))
|
(yaml/to-string (generate-cron))]))
|
||||||
|
|
|
@ -6,11 +6,14 @@
|
||||||
|
|
||||||
(def config (rc/inline "config.yaml"))
|
(def config (rc/inline "config.yaml"))
|
||||||
|
|
||||||
|
(def cron (rc/inline "cron.yaml"))
|
||||||
|
|
||||||
(def deployment (rc/inline "deployment.yaml"))
|
(def deployment (rc/inline "deployment.yaml"))
|
||||||
|
|
||||||
(defn load-resource [resource-name]
|
(defn load-resource [resource-name]
|
||||||
(case resource-name
|
(case resource-name
|
||||||
"config.yaml" config
|
"config.yaml" config
|
||||||
|
"cron.yaml" cron
|
||||||
"deployment.yaml" deployment))
|
"deployment.yaml" deployment))
|
||||||
|
|
||||||
(defn from-string [input]
|
(defn from-string [input]
|
||||||
|
|
34
src/main/resources/cron.yaml
Normal file
34
src/main/resources/cron.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: mastodon-bot-cron
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: k8s-mastodon-bot
|
||||||
|
spec:
|
||||||
|
schedule: "* */10 * * *"
|
||||||
|
successfulJobsHistoryLimit: 0
|
||||||
|
failedJobsHistoryLimit: 0
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: mastodon-bot
|
||||||
|
containers:
|
||||||
|
- image: domaindrivenarchitecture/mastodon-bot
|
||||||
|
name: mastodon-bot
|
||||||
|
env:
|
||||||
|
- name: MASTODON_BOT_CREDENTIALS
|
||||||
|
value: /credentials.edn
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /config.edn
|
||||||
|
subPath: config.edn
|
||||||
|
readOnly: true
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /credentials.edn
|
||||||
|
subPath: credentials.edn
|
||||||
|
readOnly: true
|
||||||
|
restartPolicy: Never
|
|
@ -23,7 +23,6 @@ spec:
|
||||||
env:
|
env:
|
||||||
- name: MASTODON_BOT_CREDENTIALS
|
- name: MASTODON_BOT_CREDENTIALS
|
||||||
value: /credentials.edn
|
value: /credentials.edn
|
||||||
cmd:
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /config.edn
|
mountPath: /config.edn
|
||||||
|
|
Loading…
Reference in a new issue