wip changes to core
This commit is contained in:
parent
558653d698
commit
474b86681b
2 changed files with 19 additions and 42 deletions
|
@ -62,15 +62,8 @@
|
|||
(let [{:keys [user-name user-password]} my-auth]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "deployment.yaml"))
|
||||
(assoc-in [:spec :template :spec :containers]
|
||||
[{:name "keycloak"
|
||||
: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}}}]))))
|
||||
(assoc-in [:spec :template :spec :containers 0 :env 0 :value] user-name)
|
||||
(assoc-in [:spec :template :spec :containers 0 :env 1 :value] user-password))))
|
||||
|
||||
(defn generate-certificate [config]
|
||||
(let [{:keys [fqdn issuer]
|
||||
|
|
|
@ -65,37 +65,21 @@
|
|||
|
||||
(deftest should-generate-deployment
|
||||
(is (= {:apiVersion "apps/v1"
|
||||
:kind "Deployment"
|
||||
:metadata {:name "keycloak", :namespace "default", :labels {:app "keycloak"}}
|
||||
:spec
|
||||
{:replicas 1
|
||||
:selector {:matchLabels {:app "keycloak"}}
|
||||
:template
|
||||
{:metadata {:labels {:app "keycloak"}}
|
||||
:spec
|
||||
{:containers
|
||||
[{:name "keycloak"
|
||||
:image "quay.io/keycloak/keycloak:13.0.0"
|
||||
:env
|
||||
[{:name "KEYCLOAK_USER", :value "testuser"}
|
||||
{:name "KEYCLOAK_PASSWORD", :value "test1234"}
|
||||
{:name "PROXY_ADDRESS_FORWARDING", :value "true"}]
|
||||
:ports [{:name "http", :containerPort 8080}]
|
||||
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]}}}}
|
||||
:kind "Deployment"
|
||||
:metadata {:name "keycloak", :namespace "default", :labels {:app "keycloak"}}
|
||||
:spec
|
||||
{:replicas 1
|
||||
:selector {:matchLabels {:app "keycloak"}}
|
||||
:template
|
||||
{:metadata {:labels {:app "keycloak"}}
|
||||
:spec
|
||||
{:containers
|
||||
[{:name "keycloak"
|
||||
:image "quay.io/keycloak/keycloak:13.0.0"
|
||||
:env
|
||||
[{:name "KEYCLOAK_USER", :value "testuser"}
|
||||
{:name "KEYCLOAK_PASSWORD", :value "test1234"}
|
||||
{:name "PROXY_ADDRESS_FORWARDING", :value "true"}]
|
||||
:ports [{:name "http", :containerPort 8080}]
|
||||
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]}}}}
|
||||
(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))))
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue