restart cron now might work

This commit is contained in:
Michael Jerger 2025-02-18 15:13:05 +01:00
parent 8159f85158
commit 80acabff9b
4 changed files with 24 additions and 14 deletions
src
main
cljc/dda/c4k_jitsi
resources/jitsi
test/cljc/dda/c4k_jitsi

View file

@ -39,7 +39,7 @@
(jitsi/jicofo-config resolved-config)
(jitsi/web-config resolved-config)
(jitsi/jvb-config resolved-config)
(jitsi/jibri-config resolved-config)
;(jitsi/jibri-config resolved-config)
(jitsi/restart-config resolved-config)
(jitsi/etherpad-config resolved-config)
(jitsi/excalidraw-config resolved-config)

View file

@ -127,7 +127,22 @@
(cm/replace-key-value :resourceNames ["etherpad", "excalidraw"]))
(->
(load-and-adjust-namespace "jitsi/restart-config-cron.yaml" namespace)
(cm/replace-key-value :resourceNames))]))
(cm/replace-all-matching "CRON_NAME" "restart-etherpad")
(cm/replace-key-value :schedule "0 2 * * *")
(cm/replace-key-value
:command
["bash"
"-c"
"kubectl rollout restart deployment/etherpad && kubectl rollout status deployment/etherpad"]))
(->
(load-and-adjust-namespace "jitsi/restart-config-cron.yaml" namespace)
(cm/replace-all-matching "CRON_NAME" "restart-excalidraw")
(cm/replace-key-value :schedule "0 1 * * *")
(cm/replace-key-value
:command
["bash"
"-c"
"kubectl rollout restart deployment/excalidraw && kubectl rollout status deployment/excalidraw"]))]))
(defn-spec etherpad-config cp/map-or-seq?
[config config?]

View file

@ -1,11 +1,11 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: deployment-restart
name: CRON_NAME
namespace: NAMESPACE
spec:
concurrencyPolicy: Forbid
schedule: SCHEDULE_REPLACE_Me
schedule: SCHEDULE_REPLACE_ME
jobTemplate:
spec:
backoffLimit: 2
@ -17,9 +17,4 @@ spec:
containers:
- name: kubectl
image: bitnami/kubectl
command:
- bash
- -c
- >-
kubectl rollout restart deployment/<YOUR DEPLOYMENT NAME> &&
kubectl rollout status deployment/<YOUR DEPLOYMENT NAME>
command: COMMAND_REPLACE_ME

View file

@ -140,10 +140,10 @@
2)))
(is (= {:apiVersion "batch/v1",
:kind "CronJob",
:metadata {:name "deployment-restart", :namespace "jitsi"},
:metadata {:name "restart-etherpad", :namespace "jitsi"},
:spec
{:concurrencyPolicy "Forbid",
:schedule "SCHEDULE_REPLACE_Me",
:schedule "0 2 * * *",
:jobTemplate
{:spec
{:backoffLimit 2,
@ -156,12 +156,12 @@
:command
["bash"
"-c"
"kubectl rollout restart deployment/<YOUR DEPLOYMENT NAME> && kubectl rollout status deployment/<YOUR DEPLOYMENT NAME>"]}}}}}}
"kubectl rollout restart deployment/etherpad && kubectl rollout status deployment/etherpad"]}}}}}}
(nth (cut/restart-config
{:fqdn "xy.xy.xy"
:namespace "jitsi"})
3)))
(is (= 4
(is (= 5
(count (cut/restart-config
{:fqdn "xy.xy.xy"
:namespace "jitsi"})))))