Use common monitoring

This commit is contained in:
bom 2024-07-02 15:40:42 +02:00
parent 8c41fba705
commit 85f9b3285a
3 changed files with 18 additions and 5 deletions

View file

@ -6,15 +6,21 @@
:cljs [orchestra.core :refer-macros [defn-spec]]) :cljs [orchestra.core :refer-macros [defn-spec]])
[dda.c4k-common.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-common.postgres :as postgres] [dda.c4k-common.postgres :as postgres]
[dda.c4k-common.monitoring :as mon]
[dda.c4k-shynet.shynet :as shynet])) [dda.c4k-shynet.shynet :as shynet]))
(def config-defaults {:issuer :staging}) (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] (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 (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] (defn config-objects [config]
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)]
@ -32,7 +38,9 @@
(shynet/generate-ingress config) (shynet/generate-ingress config)
(shynet/generate-service-redis) (shynet/generate-service-redis)
(shynet/generate-service-webserver) (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] (defn auth-objects [config]
(map yaml/to-string (map yaml/to-string

View file

@ -1,3 +1,5 @@
{:django-secret-key "django" {:django-secret-key "django"
:postgres-db-user "shynet" :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"}}

View file

@ -1,3 +1,6 @@
{:fqdn "statistics.test.meissa-gmbh.de" {:fqdn "statistics.test.meissa-gmbh.de"
:issuer "staging" :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"}}