Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Add pooler personality configuration on pgbouncer.ini template #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
18 changes: 9 additions & 9 deletions pgbouncer/templates/_pgbouncer.ini.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ stats_users = {{ $users }}, stats, root, monitor

;;; Pooler personality

pool_mode = {{ .Values.poolMode }}
server_reset_query = DISCARD ALL
;server_reset_query_always = 0
;ignore_startup_parameters = extra_float_digits
;server_check_query = select 1
;server_check_delay = 30
;application_name_add_host = 0
pool_mode = {{ .Values.poolMode | default .Values.poolerPersonality.poolMode | default "session" }}
server_reset_query = {{ .Values.poolerPersonality.serverResetQuery | default "DISCARD ALL" }}
server_reset_query_always = {{ .Values.poolerPersonality.serverResetQueryAlways | default 0 }}
ignore_startup_parameters = {{ .Values.poolerPersonality.ignoreStartupParameters | default "" }}
matth-boise marked this conversation as resolved.
Show resolved Hide resolved
server_check_query = {{ .Values.poolerPersonality.serverCheckQuery | default "select 1" }}
server_check_delay = {{ .Values.poolerPersonality.serverCheckDelay | default 30 }}
application_name_add_host = {{ .Values.poolerPersonality.applicationNameAddHost | default 0 }}

;;; Connection limits

Expand All @@ -77,8 +77,8 @@ default_pool_size = {{ .Values.connectionLimits.defaultPoolSize }}
min_pool_size = {{ .Values.connectionLimits.minPoolSize }}
reserve_pool_size = {{ .Values.connectionLimits.reservePoolSize }}
reserve_pool_timeout = {{ .Values.connectionLimits.reservePoolTimeout }}
;max_db_connections = 0
;max_user_connections = 0
max_db_connections = {{ .Values.connectionLimits.maxDbConnections | default 0 }}
max_user_connections = {{ .Values.connectionLimits.maxUserConnections | default 0 }}
;server_round_robin = 0
;syslog = 0
;syslog_facility = daemon
Expand Down
15 changes: 12 additions & 3 deletions pgbouncer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ nodeAffinity: {} # optionally define nodeAffinity
tolerations: [] # optionally define tolerations
nodeSelector: {} # optionally define nodeSelector

poolMode: session
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you leave the poolMode=session line - but comment it out and add comment? e.g.,
# poolMode: session # please use poolerPersonality.poolMode

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea will do it like that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angeloskyratzakos it's been a while - sorry! it would be great to get your changes in. could you make this last change - to re-add the poolMode line but commented out?

# poolMode: session # please use poolerPersonality.poolMode
poolerPersonality:
poolMode: session
# serverResetQuery: "DISCARD ALL"
# serverResetQueryAlways: 0
# ignoreStartupParameters: ""
# serverCheckQuery: "select 1"
# serverCheckDelay: 30
# applicationNameAddHost: 0

budget:
# PodDisruptionBudget spec.minAvailable
Expand All @@ -29,7 +37,6 @@ databases: {}
# dbname: dbname
# auth_user: pgbouncer


# list of users to connect to database, You can get by running this query
# psql -Atq -U postgres -d postgres -c "SELECT concat('\"', usename, '\" \"', passwd, '\"') FROM pg_shadow"
users: {}
Expand All @@ -51,14 +58,16 @@ settings:
# WHERE usename = p_usename;
# END;
# $$ LANGUAGE plpgsql SECURITY DEFINER;
auth_query: SELECT * FROM pgbouncer.get_auth($1)
auth_query: SELECT * FROM pgbouncer.get_auth($1)

connectionLimits:
maxClientConn: 200
defaultPoolSize: 200
minPoolSize: 15
reservePoolSize: 25
reservePoolTimeout: 5
# maxDbConnections: 0 # zero means unlimited
matth-boise marked this conversation as resolved.
Show resolved Hide resolved
# maxUserConnections: 0 # zero means unlimited
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above (since you didn't add templating for max_user_connections)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added for it as well please check line 81


spec:
labels: {}
Expand Down