wip changes to core

This commit is contained in:
bom 2021-05-27 12:39:26 +02:00
parent 558653d698
commit 474b86681b
2 changed files with 19 additions and 42 deletions

View file

@ -62,15 +62,8 @@
(let [{:keys [user-name user-password]} my-auth] (let [{:keys [user-name user-password]} my-auth]
(-> (->
(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 0 :env 0 :value] user-name)
[{:name "keycloak" (assoc-in [:spec :template :spec :containers 0 :env 1 :value] user-password))))
:image "quay.io/keycloak/keycloak:13.0.0"
:env
[{:name "KEYCLOAK_USER", :value user-name}
{:name "KEYCLOAK_PASSWORD", :value user-password}
{:name "PROXY_ADDRESS_FORWARDING", :value "true"}]
:ports [{:name "http", :containerPort 8080}]
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]))))
(defn generate-certificate [config] (defn generate-certificate [config]
(let [{:keys [fqdn issuer] (let [{:keys [fqdn issuer]

View file

@ -65,37 +65,21 @@
(deftest should-generate-deployment (deftest should-generate-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1"
:kind "Deployment" :kind "Deployment"
:metadata {:name "keycloak", :namespace "default", :labels {:app "keycloak"}} :metadata {:name "keycloak", :namespace "default", :labels {:app "keycloak"}}
:spec :spec
{:replicas 1 {:replicas 1
:selector {:matchLabels {:app "keycloak"}} :selector {:matchLabels {:app "keycloak"}}
:template :template
{:metadata {:labels {:app "keycloak"}} {:metadata {:labels {:app "keycloak"}}
:spec :spec
{:containers {: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 "testuser"} [{:name "KEYCLOAK_USER", :value "testuser"}
{:name "KEYCLOAK_PASSWORD", :value "test1234"} {:name "KEYCLOAK_PASSWORD", :value "test1234"}
{: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-name "testuser" :user-password "test1234"})))) (cut/generate-deployment {:user-name "testuser" :user-password "test1234"}))))
(deftest test-vector-replace-fqdn-function
(let [ingress-yaml (yaml/from-string (yaml/load-resource "ingress.yaml"))
fqdn "some_host"
desired-result (-> ingress-yaml
(assoc-in [:spec :rules] [{:host fqdn
:http {:paths [{:backend {:serviceName "keycloak"
:servicePort 8080}}]}}
{:host fqdn
:http {:paths [{:backend {:serviceName "another_keycloak"
:servicePort 8081}}]}}
]))]
(is (= desired-result (cut/assoc-in-nested ingress-yaml [:spec :rules :host] fqdn))))
)