keycloak deployment now may work

This commit is contained in:
jem 2021-05-21 17:59:44 +02:00
parent af57b9dd20
commit f2871aa383
4 changed files with 10 additions and 12 deletions

View file

@ -46,7 +46,7 @@
config-valid? (s/valid? core/config? config-edn) config-valid? (s/valid? core/config? config-edn)
auth-valid? (s/valid? core/auth? auth-edn)] auth-valid? (s/valid? core/auth? auth-edn)]
(if (and config-valid? auth-valid?) (if (and config-valid? auth-valid?)
(println (core/generate config-str auth-str)) (println (core/generate config-edn auth-edn))
(do (do
(when (not config-valid?) (when (not config-valid?)
(println (println

View file

@ -32,17 +32,16 @@
(assoc-in [:data :config.edn] (str my-config)) (assoc-in [:data :config.edn] (str my-config))
(assoc-in [ :data :credentials.edn] (str my-auth)))) (assoc-in [ :data :credentials.edn] (str my-auth))))
(defn generate-deployment [config] (defn generate-deployment [my-auth]
(let [user (:user config) (let [{:keys [user-name user-password]} my-auth]
password (:password config)]
(-> (->
(yaml/from-string (yaml/load-resource "deployment.yaml")) (yaml/from-string (yaml/load-resource "deployment.yaml"))
(assoc-in [:spec :template :spec :containers] (assoc-in [:spec :template :spec :containers]
[{:name "keycloak" [{:name "keycloak"
:image "quay.io/keycloak/keycloak:13.0.0" :image "quay.io/keycloak/keycloak:13.0.0"
:env :env
[{:name "KEYCLOAK_USER", :value user} [{:name "KEYCLOAK_USER", :value user-name}
{:name "KEYCLOAK_PASSWORD", :value password} {:name "KEYCLOAK_PASSWORD", :value user-password}
{:name "PROXY_ADDRESS_FORWARDING", :value "true"}] {:name "PROXY_ADDRESS_FORWARDING", :value "true"}]
:ports [{:name "http", :containerPort 8080}] :ports [{:name "http", :containerPort 8080}]
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}])))) :readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]))))
@ -78,10 +77,10 @@
(cs/join "\n" (cs/join "\n"
[(yaml/to-string (generate-config my-config my-auth)) [(yaml/to-string (generate-config my-config my-auth))
"---" "---"
(yaml/to-string (generate-certificate)) (yaml/to-string (generate-certificate my-config))
"---" "---"
(yaml/to-string (generate-ingress)) (yaml/to-string (generate-ingress my-config))
"---" "---"
(yaml/to-string (generate-service)) (yaml/to-string (generate-service))
"---" "---"
(yaml/to-string (generate-deployment))])) (yaml/to-string (generate-deployment my-auth))]))

View file

@ -81,4 +81,4 @@
{:name "PROXY_ADDRESS_FORWARDING", :value "true"}] {:name "PROXY_ADDRESS_FORWARDING", :value "true"}]
:ports [{:name "http", :containerPort 8080}] :ports [{:name "http", :containerPort 8080}]
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]}}}} :readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]}}}}
(cut/generate-deployment {:user "testuser" :password "test1234"})))) (cut/generate-deployment {:user-name "testuser" :user-password "test1234"}))))

View file

@ -1,2 +1 @@
{:fqdn "test.de" {:fqdn "keycloak.test.meissa-gmbh.de"}
:issuer :prod}