proper-namespace-implementation #2

Merged
patdyn merged 5 commits from proper-namespace-implementation into master 2024-08-07 13:15:32 +00:00
2 changed files with 16 additions and 7 deletions
Showing only changes of commit f64f4f3ab5 - Show all commits

View file

@ -39,8 +39,8 @@
(cm/concat-vec
(ns/generate config)
(postgres/generate config auth)
[(kc/generate-secret auth)
(kc/generate-service)
[(kc/generate-secret config auth)
(kc/generate-service config)
(kc/generate-deployment config)]
(kc/generate-ingress config)
(when (:contains? config :mon-cfg)

View file

@ -37,20 +37,29 @@
config)))
(defn-spec generate-secret cp/map-or-seq?
[auth auth?]
(let [{:keys [keycloak-admin-user keycloak-admin-password]} auth]
[config config?
auth auth?]
(let [{:keys [namespace]} config
{:keys [keycloak-admin-user keycloak-admin-password]} auth]
(->
(yaml/load-as-edn "keycloak/secret.yaml")
(cm/replace-all-matching "NAMESPACE" namespace)
(cm/replace-key-value :keycloak-user (b64/encode keycloak-admin-user))
(cm/replace-key-value :keycloak-password (b64/encode keycloak-admin-password)))))
(defn-spec generate-service cp/map-or-seq? []
(yaml/load-as-edn "keycloak/service.yaml"))
(defn-spec generate-service cp/map-or-seq?
[config config?]
(let [{:keys [namespace]} config
{:keys [keycloak-admin-user keycloak-admin-password]} auth]
(->
(yaml/load-as-edn "keycloak/service.yaml")
(cm/replace-all-matching "NAMESPACE" namespace))))
(defn-spec generate-deployment cp/map-or-seq?
[config config?]
(let [{:keys [fqdn]} config]
(let [{:keys [fqdn namespace]} config]
(->
(yaml/load-as-edn "keycloak/deployment.yaml")
(cm/replace-all-matching "NAMESPACE" namespace)
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))