Update secret generation and tests
This commit is contained in:
parent
aa9bfc482d
commit
7037d8a92a
3 changed files with 15 additions and 9 deletions
|
@ -42,12 +42,14 @@
|
||||||
[config config?
|
[config config?
|
||||||
auth auth?]
|
auth auth?]
|
||||||
(let [{:keys [namespace]} config
|
(let [{:keys [namespace]} config
|
||||||
{:keys [keycloak-admin-user keycloak-admin-password]} auth]
|
{:keys [keycloak-admin-user keycloak-admin-password postgres-db-user postgres-db-password]} auth]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "keycloak/secret.yaml")
|
(yaml/load-as-edn "keycloak/secret.yaml")
|
||||||
(cm/replace-all-matching "NAMESPACE" namespace)
|
(cm/replace-all-matching "NAMESPACE" namespace)
|
||||||
(cm/replace-key-value :keycloak-user (b64/encode keycloak-admin-user))
|
(cm/replace-all-matching "DBUSER" (b64/encode postgres-db-user))
|
||||||
(cm/replace-key-value :keycloak-password (b64/encode keycloak-admin-password)))))
|
(cm/replace-all-matching "DBPW" (b64/encode postgres-db-password))
|
||||||
|
(cm/replace-all-matching "ADMIN_USER" (b64/encode keycloak-admin-user))
|
||||||
|
(cm/replace-all-matching "ADMIN_PASS" (b64/encode keycloak-admin-password)))))
|
||||||
|
|
||||||
(defn-spec generate-service cp/map-or-seq?
|
(defn-spec generate-service cp/map-or-seq?
|
||||||
[config config?]
|
[config config?]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# TODO: Update generate-secret function
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -6,7 +5,7 @@ metadata:
|
||||||
namespace: NAMESPACE
|
namespace: NAMESPACE
|
||||||
type: Opaque
|
type: Opaque
|
||||||
data:
|
data:
|
||||||
DB_USER: DBUSER
|
KC_DB_USERNAME: DBUSER
|
||||||
DB_PASSWORD: DBPW
|
KC_DB_PASSWORD: DBPW
|
||||||
KEYCLOAK_ADMIN: ADMIN_USER
|
KEYCLOAK_ADMIN: ADMIN_USER
|
||||||
KEYCLOAK_ADMIN_PASSWORD: ADMIN_PASS
|
KEYCLOAK_ADMIN_PASSWORD: ADMIN_PASS
|
||||||
|
|
|
@ -13,9 +13,14 @@
|
||||||
:metadata {:name "keycloak-secret", :namespace "keycloak"}
|
:metadata {:name "keycloak-secret", :namespace "keycloak"}
|
||||||
:type "Opaque"
|
:type "Opaque"
|
||||||
:data
|
:data
|
||||||
{:keycloak-user "dXNlcg=="
|
{:KEYCLOAK_ADMIN "dXNlcg=="
|
||||||
:keycloak-password "cGFzc3dvcmQ="}}
|
:KEYCLOAK_ADMIN_PASSWORD "cGFzc3dvcmQ="
|
||||||
(cut/generate-secret {:namespace "keycloak" :fqdn "test.de"} {:keycloak-admin-user "user" :keycloak-admin-password "password"}))))
|
:DB_USER "a2V5Y2xvYWs="
|
||||||
|
:DB_PASSWORD "ZGItcGFzc3dvcmQ="}}
|
||||||
|
(cut/generate-secret {:namespace "keycloak" :fqdn "test.de"}
|
||||||
|
{:keycloak-admin-user "user" :keycloak-admin-password "password"
|
||||||
|
:postgres-db-user "keycloak"
|
||||||
|
:postgres-db-password "db-password"}))))
|
||||||
|
|
||||||
(deftest should-generate-deployment
|
(deftest should-generate-deployment
|
||||||
(is (= {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}}
|
(is (= {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}}
|
||||||
|
|
Loading…
Reference in a new issue