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?
|
||||
auth auth?]
|
||||
(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")
|
||||
(cm/replace-all-matching "NAMESPACE" namespace)
|
||||
(cm/replace-key-value :keycloak-user (b64/encode keycloak-admin-user))
|
||||
(cm/replace-key-value :keycloak-password (b64/encode keycloak-admin-password)))))
|
||||
(cm/replace-all-matching "DBUSER" (b64/encode postgres-db-user))
|
||||
(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?
|
||||
[config config?]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# TODO: Update generate-secret function
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
|
@ -6,7 +5,7 @@ metadata:
|
|||
namespace: NAMESPACE
|
||||
type: Opaque
|
||||
data:
|
||||
DB_USER: DBUSER
|
||||
DB_PASSWORD: DBPW
|
||||
KC_DB_USERNAME: DBUSER
|
||||
KC_DB_PASSWORD: DBPW
|
||||
KEYCLOAK_ADMIN: ADMIN_USER
|
||||
KEYCLOAK_ADMIN_PASSWORD: ADMIN_PASS
|
||||
|
|
|
@ -13,9 +13,14 @@
|
|||
:metadata {:name "keycloak-secret", :namespace "keycloak"}
|
||||
:type "Opaque"
|
||||
:data
|
||||
{:keycloak-user "dXNlcg=="
|
||||
:keycloak-password "cGFzc3dvcmQ="}}
|
||||
(cut/generate-secret {:namespace "keycloak" :fqdn "test.de"} {:keycloak-admin-user "user" :keycloak-admin-password "password"}))))
|
||||
{:KEYCLOAK_ADMIN "dXNlcg=="
|
||||
:KEYCLOAK_ADMIN_PASSWORD "cGFzc3dvcmQ="
|
||||
: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
|
||||
(is (= {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}}
|
||||
|
|
Loading…
Reference in a new issue