Make core reject invalid monitoring configs

This commit is contained in:
bom 2023-01-27 14:14:48 +01:00
parent 938ba80275
commit af17850b06
5 changed files with 15 additions and 8 deletions

View file

@ -5,7 +5,7 @@
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "6.0.0"]]
[org.domaindrivenarchitecture/c4k-common-clj "6.0.1"]]
:target-path "target/%s/"
:source-paths ["src/main/cljc"
"src/main/clj"]

View file

@ -14,16 +14,16 @@
(def config-defaults {:issuer "staging"})
(s/def ::config (s/keys :req-un [::kc/fqdn]
(def config? (s/keys :req-un [::kc/fqdn]
:opt-un [::kc/issuer
::mon/config]))
::mon/mon-cfg]))
(def auth? (s/keys :req-un [::kc/keycloak-admin-user ::kc/keycloak-admin-password
::postgres/postgres-db-user ::postgres/postgres-db-password]
:opt-un [::mon/auth]))
(defn-spec k8s-objects cp/map-or-seq?
[config ::config
[config config?
auth auth?]
(map yaml/to-string
(filter

View file

@ -16,5 +16,6 @@
;; TODO: 2023.01.27 - jem: may not validate k3s-cluster-name entries ... find out what's wrong.
(deftest validate-valid-resources
(is (s/valid? ::cut/config (yaml/load-as-edn "keycloak-test/valid-config.yaml")))
(is (s/valid? cut/auth? (yaml/load-as-edn "keycloak-test/valid-auth.yaml"))))
(is (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/valid-config.yaml")))
(is (s/valid? cut/auth? (yaml/load-as-edn "keycloak-test/valid-auth.yaml")))
(is (not (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/invalid-config.yaml")))))

View file

@ -0,0 +1,6 @@
fqdn: "keycloak.test.meissa-gmbh.de"
issuer: "staging"
mon-cfg:
grafana-clod-url: "url-for-your-prom-remote-write-endpoint"
cluster-nam: "keycloak"
cluster-stage: "none"

View file

@ -3,4 +3,4 @@ issuer: "staging"
mon-cfg:
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
cluster-name: "keycloak"
cluster-stage: :test
cluster-stage: "test"