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 (cm/concat-vec
(ns/generate config) (ns/generate config)
(postgres/generate config auth) (postgres/generate config auth)
[(kc/generate-secret auth) [(kc/generate-secret config auth)
(kc/generate-service) (kc/generate-service config)
(kc/generate-deployment config)] (kc/generate-deployment config)]
(kc/generate-ingress config) (kc/generate-ingress config)
(when (:contains? config :mon-cfg) (when (:contains? config :mon-cfg)

View file

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