Split for generation of config and auth objects #4

Merged
gec merged 9 commits from split-config-auth into main 2024-07-19 09:06:52 +00:00
3 changed files with 11 additions and 8 deletions
Showing only changes of commit 52e3ba6ae1 - Show all commits

View file

@ -26,7 +26,7 @@
"monitoring/node-exporter-service.yaml" (rc/inline "monitoring/node-exporter-service.yaml") "monitoring/node-exporter-service.yaml" (rc/inline "monitoring/node-exporter-service.yaml")
"monitoring/prometheus-cluster-role-binding.yaml" (rc/inline "monitoring/prometheus-cluster-role-binding.yaml") "monitoring/prometheus-cluster-role-binding.yaml" (rc/inline "monitoring/prometheus-cluster-role-binding.yaml")
"monitoring/prometheus-cluster-role.yaml" (rc/inline "monitoring/prometheus-cluster-role.yaml") "monitoring/prometheus-cluster-role.yaml" (rc/inline "monitoring/prometheus-cluster-role.yaml")
"monitoring/prometheus-config.yaml" (rc/inline "monitoring/prometheus-config.yaml") "monitoring/prometheus-config-secret.yaml" (rc/inline "monitoring/prometheus-config-secret.yaml")
"monitoring/prometheus-deployment.yaml" (rc/inline "monitoring/prometheus-deployment.yaml") "monitoring/prometheus-deployment.yaml" (rc/inline "monitoring/prometheus-deployment.yaml")
"monitoring/prometheus-prometheus.yaml" (rc/inline "monitoring/prometheus-prometheus.yaml") "monitoring/prometheus-prometheus.yaml" (rc/inline "monitoring/prometheus-prometheus.yaml")
"monitoring/prometheus-service-account.yaml" (rc/inline "monitoring/prometheus-service-account.yaml") "monitoring/prometheus-service-account.yaml" (rc/inline "monitoring/prometheus-service-account.yaml")

View file

@ -8,7 +8,7 @@
(st/instrument `cut/generate-stateful-set) (st/instrument `cut/generate-stateful-set)
(st/instrument `cut/generate-agent-config) (st/instrument `cut/generate-agent-config)
(st/instrument `cut/generate-config) (st/instrument `cut/generate-config-secret)
(def conf {:cluster-name "clustername" (def conf {:cluster-name "clustername"
:cluster-stage "test" :cluster-stage "test"
@ -29,12 +29,12 @@
(deftest should-not-generate-config (deftest should-not-generate-config
(is (thrown? (is (thrown?
#?(:clj Exception :cljs js/Error) #?(:clj Exception :cljs js/Error)
(cut/generate-config invalid-conf auth)))) (cut/generate-config-secret invalid-conf auth))))
(deftest should-not-generate-auth (deftest should-not-generate-auth
(is (thrown? (is (thrown?
#?(:clj Exception :cljs js/Error) #?(:clj Exception :cljs js/Error)
(cut/generate-config conf invalid-auth)))) (cut/generate-config-secret conf invalid-auth))))
(deftest should-generate-prometheus-remote-write-auth (deftest should-generate-prometheus-remote-write-auth
@ -54,6 +54,6 @@
(deftest should-generate-config (deftest should-generate-config
(is (str/starts-with? (is (str/starts-with?
(get-in (get-in
(cut/generate-config conf auth) (cut/generate-config-secret conf auth)
[:stringData :prometheus.yaml]) [:stringData :prometheus.yaml])
"global:\n scrape_interval:"))) "global:\n scrape_interval:")))

View file

@ -5,7 +5,8 @@
[clojure.spec.test.alpha :as st] [clojure.spec.test.alpha :as st]
[dda.c4k-common.monitoring :as cut])) [dda.c4k-common.monitoring :as cut]))
(st/instrument `cut/generate) (st/instrument `cut/generate-config)
(st/instrument `cut/generate-auth)
(def conf {:cluster-name "clustername" (def conf {:cluster-name "clustername"
:cluster-stage "test" :cluster-stage "test"
@ -17,5 +18,7 @@
(deftest should-generate (deftest should-generate
(is (= 17 (is (= 16
(count (cut/generate conf auth))))) (count (cut/generate-config conf auth))))
(is (= 1
(count (cut/generate-auth conf auth)))))