Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions manifests/components/pgbouncer/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ spec:
image: bitnami/pgbouncer:latest
envFrom:
- configMapRef:
name: pgbouncer
name: pgbouncer-bitnami
- secretRef:
name: pgbouncer
name: pgbouncer-bitnami
ports:
- containerPort: 5432
name: session-prt
Expand All @@ -31,13 +31,20 @@ spec:
cpu: 50m
memory: 50Mi
volumeMounts:
- name: auth-file
mountPath: /etc/pgbouncer/auth_file
- name: config-vol
mountPath: /bitnami/pgbouncer/conf/
readOnly: true
volumes:
- name: auth-file
secret:
secretName: auth-file
- name: config-vol # cannot name it to 'config' or kubernetes will not be able to find it.
projected:
sources:
- configMap:
name: pgbouncer
- secret:
name: pgbouncer
items:
- key: auth_file
path: userlist.txt
# assign pods to nodes with the postgres primary
affinity:
podAffinity:
Expand Down
11 changes: 8 additions & 3 deletions manifests/components/pgbouncer/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ resources:

configMapGenerator:
- name: pgbouncer
files:
- pgbouncer.ini
# The bitnami pgbouncer image requires some environment variables to work, although they are overridden by the config file
- name: pgbouncer-bitnami
envs:
- params.env

secretGenerator:
- name: pgbouncer
envs:
- secret-params.env
- name: auth-file
files:
- auth_file
# The bitnami pgbouncer image requires some environment variables to work, although they are overridden by the config file
- name: pgbouncer-bitnami
envs:
- secret-params.env

images:
- name: bitnami/pgbouncer
Expand Down
8 changes: 0 additions & 8 deletions manifests/components/pgbouncer/params.env
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
POSTGRESQL_HOST=postgres.postgres-shared.svc.cluster.local
PGBOUNCER_PORT=5432
PGBOUNCER_DEFAULT_POOL_SIZE=100
PGBOUNCER_MAX_CLIENT_CONN=100
PGBOUNCER_POOL_MODE=session
PGBOUNCER_IGNORE_STARTUP_PARAMETERS=extra_float_digits,search_path
# PgBouncer exposed database. This is the database that clients can connect to.
PGBOUNCER_DATABASE=chatbot
PGBOUNCER_AUTH_USER=chatbot
PGBOUNCER_AUTH_TYPE=scram-sha-256
26 changes: 26 additions & 0 deletions manifests/components/pgbouncer/pgbouncer.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; This file is modified on a base generated by <https://hub.docker.com/r/bitnami/pgbouncer>
; The source code of the base image can be found at <https://github.com/bitnami/containers/tree/main/bitnami/pgbouncer>

[databases]
chatbot = host=postgres.postgres-shared.svc.cluster.local port=5432 dbname=chatbot auth_user=chatbot pool_size=200
chatbot-standby = host=postgres-replica.postgres-shared.svc.cluster.local port=5432 dbname=chatbot auth_user=chatbot pool_size=200
* = host=postgres.postgres-shared.svc.cluster.local

[pgbouncer]
listen_port=5432
listen_addr=0.0.0.0
unix_socket_dir=/tmp/
unix_socket_mode=0777
auth_file=/opt/bitnami/pgbouncer/conf/userlist.txt
auth_type=scram-sha-256
pidfile=/opt/bitnami/pgbouncer/tmp/pgbouncer.pid
admin_users=chatbot
client_tls_sslmode=disable
server_tls_sslmode=disable
pool_mode=session
max_client_conn=400
default_pool_size=100
ignore_startup_parameters=extra_float_digits
stats_period=60
server_round_robin=0
server_fast_close=0