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/jicofo-config resolved-config)
(jitsi/web-config resolved-config) (jitsi/web-config resolved-config)
(jitsi/jvb-config resolved-config) (jitsi/jvb-config resolved-config)
(jitsi/jibri-config resolved-config) ;(jitsi/jibri-config resolved-config)
(jitsi/restart-config resolved-config) (jitsi/restart-config resolved-config)
(jitsi/etherpad-config resolved-config) (jitsi/etherpad-config resolved-config)
(jitsi/excalidraw-config resolved-config) (jitsi/excalidraw-config resolved-config)

View file

@ -127,7 +127,22 @@
(cm/replace-key-value :resourceNames ["etherpad", "excalidraw"])) (cm/replace-key-value :resourceNames ["etherpad", "excalidraw"]))
(-> (->
(load-and-adjust-namespace "jitsi/restart-config-cron.yaml" namespace) (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? (defn-spec etherpad-config cp/map-or-seq?
[config config?] [config config?]

View file

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

View file

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