allow pg pinning override
This commit is contained in:
parent
ce72dc84eb
commit
bc2ffc0693
3 changed files with 34 additions and 3 deletions
|
@ -39,8 +39,12 @@
|
|||
(yaml/from-string (yaml/load-resource (str "postgres/config-" (name postgres-size) ".yaml")))
|
||||
(assoc-in [:data :postgres-db] db-name))))
|
||||
|
||||
(defn generate-deployment []
|
||||
(yaml/from-string (yaml/load-resource "postgres/deployment.yaml")))
|
||||
(defn generate-deployment [& args]
|
||||
(let [{:keys [postgres-image]
|
||||
:or {postgres-image "postgres:13"}} args]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "postgres/deployment.yaml"))
|
||||
(assoc-in [:spec :template :spec :containers 0 :image] postgres-image))))
|
||||
|
||||
(defn generate-persistent-volume [config]
|
||||
(let [{:keys [postgres-data-volume-path]} config]
|
||||
|
|
|
@ -14,7 +14,7 @@ spec:
|
|||
app: postgresql
|
||||
spec:
|
||||
containers:
|
||||
- image: postgres:13
|
||||
- image: postgres
|
||||
name: postgresql
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
|
|
|
@ -39,3 +39,30 @@
|
|||
:data
|
||||
{:postgres-user "eHgtdXM=", :postgres-password "eHgtcHc="}}
|
||||
(cut/generate-secret {:postgres-db-user "xx-us" :postgres-db-password "xx-pw"}))))
|
||||
|
||||
(deftest should-generate-deployment
|
||||
(is (= [{:image "postgres:14"
|
||||
:name "postgresql"
|
||||
:env
|
||||
[{:name "POSTGRES_USER"
|
||||
:valueFrom
|
||||
{:secretKeyRef
|
||||
{:name "postgres-secret", :key "postgres-user"}}}
|
||||
{:name "POSTGRES_PASSWORD"
|
||||
:valueFrom
|
||||
{:secretKeyRef
|
||||
{:name "postgres-secret", :key "postgres-password"}}}
|
||||
{:name "POSTGRES_DB"
|
||||
:valueFrom
|
||||
{:configMapKeyRef
|
||||
{:name "postgres-config", :key "postgres-db"}}}]
|
||||
:ports [{:containerPort 5432, :name "postgresql"}]
|
||||
:volumeMounts
|
||||
[{:name "postgres-config-volume"
|
||||
:mountPath "/etc/postgresql/postgresql.conf"
|
||||
:subPath "postgresql.conf"
|
||||
:readOnly true}
|
||||
{:name "postgre-data-volume"
|
||||
:mountPath "/var/lib/postgresql/data"}]}]
|
||||
(get-in (cut/generate-deployment :postgres-image "postgres:14")
|
||||
[:spec :template :spec :containers]))))
|
||||
|
|
Loading…
Reference in a new issue