diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml b/chart/templates/pgbouncer/pgbouncer-deployment.yaml index fb8c784842af0..f2e31cb029233 100644 --- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml +++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml @@ -38,7 +38,7 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: - replicas: 1 + replicas: {{ .Values.pgbouncer.replicas | default "1" }} {{- if $revisionHistoryLimit }} revisionHistoryLimit: {{ $revisionHistoryLimit }} {{- end }} diff --git a/chart/values.schema.json b/chart/values.schema.json index faaed86f8e704..a9fd848ab55a0 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -4161,6 +4161,11 @@ "x-docsSection": "Common", "default": false }, + "replicas": { + "description": "Number of PgBouncer replicas to run in Deployment.", + "type": "integer", + "default": 1 + }, "revisionHistoryLimit": { "description": "Number of old replicasets to retain.", "type": [ diff --git a/chart/values.yaml b/chart/values.yaml index c844bd8009e31..9eaa6f2d09320 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1381,6 +1381,8 @@ statsd: pgbouncer: # Enable PgBouncer enabled: false + # Number of PgBouncer replicas to run in Deployment + replicas: 1 # Max number of old replicasets to retain revisionHistoryLimit: ~ # Command to use for PgBouncer(templated). diff --git a/tests/charts/test_pgbouncer.py b/tests/charts/test_pgbouncer.py index e5d97da232773..f57d982902f44 100644 --- a/tests/charts/test_pgbouncer.py +++ b/tests/charts/test_pgbouncer.py @@ -307,6 +307,18 @@ def test_should_add_extra_volume_and_extra_volume_mount(self): "spec.template.spec.containers[0].volumeMounts[*].name", docs[0] ) + def test_pgbouncer_replicas_are_configurable(self): + docs = render_chart( + values={ + "pgbouncer": { + "enabled": True, + "replicas": 2, + }, + }, + show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"], + ) + assert 2 == jmespath.search("spec.replicas", docs[0]) + class TestPgbouncerConfig: def test_config_not_created_by_default(self):