From 85f9b3285afdae5f4cd0518e4390a642f06c275b Mon Sep 17 00:00:00 2001 From: bom Date: Tue, 2 Jul 2024 15:40:42 +0200 Subject: [PATCH] Use common monitoring --- src/main/cljc/dda/c4k_shynet/core.cljc | 14 +++++++++++--- valid-auth.edn | 4 +++- valid-config.edn | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/cljc/dda/c4k_shynet/core.cljc b/src/main/cljc/dda/c4k_shynet/core.cljc index 12876ba..38647b5 100644 --- a/src/main/cljc/dda/c4k_shynet/core.cljc +++ b/src/main/cljc/dda/c4k_shynet/core.cljc @@ -6,15 +6,21 @@ :cljs [orchestra.core :refer-macros [defn-spec]]) [dda.c4k-common.yaml :as yaml] [dda.c4k-common.postgres :as postgres] + [dda.c4k-common.monitoring :as mon] [dda.c4k-shynet.shynet :as shynet])) (def config-defaults {:issuer :staging}) +(s/def ::mon-cfg ::mon/mon-cfg) +(s/def ::mon-auth ::mon/mon-auth) + (def config? (s/keys :req-un [::shynet/fqdn] - :opt-un [::shynet/issuer])) + :opt-un [::shynet/issuer + ::mon-cfg])) (def auth? (s/keys :req-un [::shynet/django-secret-key - ::postgres/postgres-db-user ::postgres/postgres-db-password])) + ::postgres/postgres-db-user ::postgres/postgres-db-password + ::mon-auth])) (defn config-objects [config] (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] @@ -32,7 +38,9 @@ (shynet/generate-ingress config) (shynet/generate-service-redis) (shynet/generate-service-webserver) - (shynet/generate-statefulset)]))) + (shynet/generate-statefulset) + (when (:contains? config :mon-cfg) + (mon/generate (:mon-cfg config) (:mon-auth config)))]))) (defn auth-objects [config] (map yaml/to-string diff --git a/valid-auth.edn b/valid-auth.edn index 0872d1b..70867c0 100644 --- a/valid-auth.edn +++ b/valid-auth.edn @@ -1,3 +1,5 @@ {:django-secret-key "django" :postgres-db-user "shynet" - :postgres-db-password "shynet-db-password"} + :postgres-db-password "shynet-db-password" + :mon-auth {:grafana-cloud-user "user" + :grafana-cloud-password "password"}} diff --git a/valid-config.edn b/valid-config.edn index e261085..1babe5f 100644 --- a/valid-config.edn +++ b/valid-config.edn @@ -1,3 +1,6 @@ {:fqdn "statistics.test.meissa-gmbh.de" :issuer "staging" - :postgres-data-volume-path "/var/postgres"} + :postgres-data-volume-path "/var/postgres" + :mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint" + :k3s-cluster-name "jitsi" + :k3s-cluster-stage "test"}}