diff --git a/src/main/cljc/dda/c4k_keycloak/core.cljc b/src/main/cljc/dda/c4k_keycloak/core.cljc index ce1c22b..2cfcbcf 100644 --- a/src/main/cljc/dda/c4k_keycloak/core.cljc +++ b/src/main/cljc/dda/c4k_keycloak/core.cljc @@ -13,11 +13,18 @@ (def default-storage-class :local-path) -(def config-defaults {:issuer "staging"}) +(def config-defaults {:issuer "staging", + :namespace "keycloak" + :postgres-image "postgres:14" + :postgres-size :2gb + :db-name "keycloak" + :pv-storage-size-gb 30 + :pvc-storage-class-name default-storage-class}) (def config? (s/keys :req-un [::kc/fqdn] :opt-un [::kc/issuer - ::mon/mon-cfg])) + ::mon/mon-cfg + ::kc/namespace])) (def auth? (s/keys :req-un [::kc/keycloak-admin-user ::kc/keycloak-admin-password ::postgres/postgres-db-user ::postgres/postgres-db-password] @@ -30,17 +37,11 @@ (filter #(not (nil? %)) (cm/concat-vec - (ns/generate (merge {:namespace "keycloak"} config)) - (postgres/generate (merge {:postgres-image "postgres:14" - :postgres-size :2gb - :db-name "keycloak" - :pv-storage-size-gb 30 - :pvc-storage-class-name default-storage-class - :namespace "keycloak"}) - auth) + (ns/generate config) + (postgres/generate config auth) [(kc/generate-secret auth) (kc/generate-service) (kc/generate-deployment config)] - (kc/generate-ingress (merge {:namespace "keycloak"} config)) + (kc/generate-ingress config) (when (:contains? config :mon-cfg) (mon/generate (:mon-cfg config) (:mon-auth auth))))))) diff --git a/src/main/cljc/dda/c4k_keycloak/keycloak.cljc b/src/main/cljc/dda/c4k_keycloak/keycloak.cljc index 3378846..3cf61a0 100644 --- a/src/main/cljc/dda/c4k_keycloak/keycloak.cljc +++ b/src/main/cljc/dda/c4k_keycloak/keycloak.cljc @@ -11,12 +11,14 @@ [dda.c4k-common.predicate :as cp])) (s/def ::fqdn cp/fqdn-string?) +(s/def ::namespace string?) (s/def ::issuer cp/letsencrypt-issuer?) (s/def ::keycloak-admin-user cp/bash-env-string?) (s/def ::keycloak-admin-password cp/bash-env-string?) (def config? (s/keys :req-un [::fqdn] - :opt-un [::issuer])) + :opt-un [::issuer + ::namespace])) (def auth? (s/keys :req-un [::keycloak-admin-user ::keycloak-admin-password]))