Allow custom pgbouncer pass and enhance volume handling
This commit is contained in:
parent
aaebe5a8b7
commit
7cd3aeb29e
|
@ -65,7 +65,7 @@ _EOT
|
|||
|
||||
template {
|
||||
data =<<_EOT
|
||||
"[[ .instance ]]" "{{ env "NOMAD_ALLOC_ID" }}"
|
||||
"[[ .postgres.pooler.local_user ]]" "[[ .postgres.pooler.local_password ]]"
|
||||
_EOT
|
||||
destination = "secrets/pgbouncer.users"
|
||||
uid = 106432
|
||||
|
|
|
@ -10,13 +10,21 @@
|
|||
[[- $volumes = . ]]
|
||||
[[- end ]]
|
||||
[[- range $volname, $volume := $volumes ]]
|
||||
|
||||
[[- $type := "" ]]
|
||||
[[- if has $volume "type" ]]
|
||||
[[- $type = $volume.type ]]
|
||||
[[- else ]]
|
||||
[[- $type = "csi" ]]
|
||||
[[- end ]]
|
||||
|
||||
volume "[[ $volname ]]" {
|
||||
source = [[ $volume.source | toJSON ]]
|
||||
type = [[ $volume.type | toJSON ]]
|
||||
source = "[[ if has $volume "source" ]][[ $volume.source ]][[ else ]][[ $volname ]][[ end ]]"
|
||||
type = "[[ $type ]]"
|
||||
[[- if has $volume "read_only" ]]
|
||||
read_only = [[ if $volume.read_only ]]true[[ else ]]false[[ end ]]
|
||||
[[- end ]]
|
||||
[[- if ne $volume.type "host" ]]
|
||||
[[- if ne $type "host" ]]
|
||||
access_mode = "[[ if has $volume "access_mode" ]][[ $volume.access_mode ]][[ else ]]single-node-writer[[ end ]]"
|
||||
attachment_mode = "file-system"
|
||||
[[- end ]]
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[[- if has . "volumes" ]]
|
||||
[[- range $volname, $volume := .volumes ]]
|
||||
[[- if has $volume "destination" ]]
|
||||
volume_mount {
|
||||
volume = "[[ $volname ]]"
|
||||
destination = "[[ $volume.destination ]]"
|
||||
[[- if has $volume "read_only" ]]
|
||||
read_only = [[ if $volume.read_only ]]true[[ else ]]false[[ end ]]
|
||||
[[- end ]]
|
||||
}
|
||||
[[- end ]]
|
||||
[[- end ]]
|
||||
[[- end ]]
|
|
@ -104,6 +104,9 @@ postgres:
|
|||
pooler:
|
||||
# Only none or pgbouncer supported for now
|
||||
engine: none
|
||||
# Credentials of the local user created (for the app to auth on the pooler)
|
||||
local_user: '[[ .instance ]]'
|
||||
local_password: '{{ env "NOMAD_ALLOC_ID" }}'
|
||||
# Port on which the pooler will listen
|
||||
port: 6432
|
||||
# Mode can be session or transaction
|
||||
|
|
Loading…
Reference in New Issue