Skip to content

Commit b77ef11

Browse files
committed
feat(pgbouncer): allow configuring pgbouncer-exporter connection
This commit introduces the ability to configure the pgbouncer-exporter connection string parameters, including host, port, database, sslmode, and connect_timeout. This addresses issue #25.
1 parent ea71a59 commit b77ef11

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

charts/pgbouncer/templates/deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
3131
{{- if .Values.pgbouncerExporter.enabled }}
3232
prometheus.io/scrape: "true"
33-
prometheus.io/port: "{{ .Values.pgbouncerExporter.port }}"
33+
prometheus.io/port: "{{ .Values.pgbouncerExporter.servicePort }}"
3434
prometheus.io/path: "/metrics"
3535
{{- end }}
3636
{{- range $key, $value := .Values.podAnnotations }}
@@ -135,11 +135,11 @@ spec:
135135
image: {{ template "pgbouncer.exporterImage" . }}
136136
imagePullPolicy: {{ .Values.pgbouncerExporter.image.pullPolicy }}
137137
args:
138-
- --web.listen-address=:{{ .Values.pgbouncerExporter.port }}
138+
- --web.listen-address=:{{ .Values.pgbouncerExporter.servicePort }}
139139
- --web.telemetry-path=/metrics
140140
- --log.level={{ .Values.pgbouncerExporter.log.level }}
141141
- --log.format={{ .Values.pgbouncerExporter.log.format }}
142-
- --pgBouncer.connectionString=postgres://$(PGBOUNCER_USER):$(PGBOUNCER_PASS)@127.0.0.1:5432/pgbouncer?sslmode=disable&connect_timeout=10
142+
- --pgBouncer.connectionString=postgres://$(PGBOUNCER_USER):$(PGBOUNCER_PASS)@{{ .Values.pgbouncerExporter.host }}:{{ .Values.pgbouncerExporter.port }}/{{ .Values.pgbouncerExporter.database }}?sslmode={{ .Values.pgbouncerExporter.sslmode }}&connect_timeout={{ .Values.pgbouncerExporter.connect_timeout }}
143143
env:
144144
- name: PGBOUNCER_USER
145145
valueFrom:

charts/pgbouncer/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,13 @@ pgbouncerExporter:
229229
imagePullSecrets: []
230230
# -- Whether to create a PodMonitor for scraping metrics (Prometheus Operator).
231231
podMonitor: false
232+
host: 127.0.0.1
233+
port: 5432
234+
database: pgbouncer
235+
sslmode: "disable"
236+
connect_timeout: 10
232237
# -- The container port for the exporter.
233-
port: 9127
238+
servicePort: 9127
234239
image:
235240
# -- Exporter image registry
236241
registry: ""

0 commit comments

Comments
 (0)