Update and test deployment generation
This commit is contained in:
parent
ce9d51e1cd
commit
aa9bfc482d
2 changed files with 5 additions and 62 deletions
|
@ -55,12 +55,11 @@
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "keycloak/service.yaml")
|
(yaml/load-as-edn "keycloak/service.yaml")
|
||||||
(cm/replace-all-matching "NAMESPACE" namespace))))
|
(cm/replace-all-matching "NAMESPACE" namespace))))
|
||||||
; TODO: Fix test
|
|
||||||
(defn-spec generate-deployment cp/map-or-seq?
|
(defn-spec generate-deployment cp/map-or-seq?
|
||||||
[config config?]
|
[config config?]
|
||||||
(let [{:keys [fqdn namespace]} 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 "NAMESPACE" namespace))))
|
||||||
(cm/replace-all-matching "FQDN" fqdn))))
|
|
||||||
|
|
||||||
|
|
|
@ -18,61 +18,5 @@
|
||||||
(cut/generate-secret {:namespace "keycloak" :fqdn "test.de"} {:keycloak-admin-user "user" :keycloak-admin-password "password"}))))
|
(cut/generate-secret {:namespace "keycloak" :fqdn "test.de"} {:keycloak-admin-user "user" :keycloak-admin-password "password"}))))
|
||||||
|
|
||||||
(deftest should-generate-deployment
|
(deftest should-generate-deployment
|
||||||
(is (= {:apiVersion "apps/v1",
|
(is (= {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}}
|
||||||
:kind "Deployment",
|
(:metadata (cut/generate-deployment {:fqdn "example.com" :namespace "keycloak"})))))
|
||||||
:metadata
|
|
||||||
{:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}},
|
|
||||||
:spec
|
|
||||||
{:replicas 1,
|
|
||||||
:selector {:matchLabels {:app "keycloak"}},
|
|
||||||
:template
|
|
||||||
{:metadata {:labels {:app "keycloak"}},
|
|
||||||
:spec
|
|
||||||
{:containers
|
|
||||||
[{:name "keycloak",
|
|
||||||
:image "quay.io/keycloak/keycloak:20.0.3",
|
|
||||||
:imagePullPolicy "IfNotPresent",
|
|
||||||
:args ["start"],
|
|
||||||
:volumeMounts
|
|
||||||
[{:name "keycloak-cert",
|
|
||||||
:mountPath "/etc/certs",
|
|
||||||
:readOnly true}],
|
|
||||||
:env
|
|
||||||
[{:name "KC_HTTPS_CERTIFICATE_FILE",
|
|
||||||
:value "/etc/certs/tls.crt"}
|
|
||||||
{:name "KC_HTTPS_CERTIFICATE_KEY_FILE",
|
|
||||||
:value "/etc/certs/tls.key"}
|
|
||||||
{:name "KC_HOSTNAME", :value "test.de"}
|
|
||||||
{:name "KC_PROXY", :value "edge"}
|
|
||||||
{:name "DB_VENDOR", :value "POSTGRES"}
|
|
||||||
{:name "DB_ADDR", :value "postgresql-service"}
|
|
||||||
{:name "DB_SCHEMA", :value "public"}
|
|
||||||
{:name "DB_DATABASE",
|
|
||||||
:valueFrom
|
|
||||||
{:configMapKeyRef
|
|
||||||
{:name "postgres-config", :key "postgres-db"}}}
|
|
||||||
{:name "DB_USER",
|
|
||||||
:valueFrom
|
|
||||||
{:secretKeyRef
|
|
||||||
{:name "postgres-secret", :key "postgres-user"}}}
|
|
||||||
{:name "DB_PASSWORD",
|
|
||||||
:valueFrom
|
|
||||||
{:secretKeyRef
|
|
||||||
{:name "postgres-secret", :key "postgres-password"}}}
|
|
||||||
{:name "KEYCLOAK_ADMIN",
|
|
||||||
:valueFrom
|
|
||||||
{:secretKeyRef
|
|
||||||
{:name "keycloak-secret", :key "keycloak-user"}}}
|
|
||||||
{:name "KEYCLOAK_ADMIN_PASSWORD",
|
|
||||||
:valueFrom
|
|
||||||
{:secretKeyRef
|
|
||||||
{:name "keycloak-secret", :key "keycloak-password"}}}],
|
|
||||||
:ports [{:name "http", :containerPort 8080}]}],
|
|
||||||
:volumes
|
|
||||||
[{:name "keycloak-cert",
|
|
||||||
:secret
|
|
||||||
{:secretName "keycloak",
|
|
||||||
:items
|
|
||||||
[{:key "tls.crt", :path "tls.crt"}
|
|
||||||
{:key "tls.key", :path "tls.key"}]}}]}}}}
|
|
||||||
(cut/generate-deployment {:fqdn "test.de" :namespace "keycloak"}))))
|
|
||||||
|
|
Loading…
Reference in a new issue