From 25f89958cd49231045d44870594f5e319fbb6a82 Mon Sep 17 00:00:00 2001 From: Simon Beck Date: Wed, 11 Dec 2024 14:41:58 +0100 Subject: [PATCH] Fix wrong pgbouncer toggle Unfortunately we inverted the boolean that enables/disables the pgbouncer. Currently if `service.disablePgBouncer: false` is set, it will result in `disableConnectionPooling: true` in the sgcluster. Which in fact disables the pgbouncer, while it should be enabled in that case. As both booleans are negative already, they should not be inverted! --- .../functions/vshnpostgres/postgresql_deploy.go | 6 +----- .../functions/vshnpostgres/postgresql_deploy_test.go | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy.go b/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy.go index 52f19be0e..a8e81172d 100644 --- a/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy.go +++ b/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy.go @@ -417,7 +417,7 @@ func createSgCluster(ctx context.Context, comp *vshnv1.VSHNPostgreSQL, svc *runt Scheduling: &sgv1.SGClusterSpecPodsScheduling{ NodeSelector: nodeSelector, }, - DisableConnectionPooling: ptr.To(false), + DisableConnectionPooling: ptr.To(comp.Spec.Parameters.Service.DisablePgBouncer), }, NonProductionOptions: &sgv1.SGClusterSpecNonProductionOptions{ EnableSetPatroniCpuRequests: ptr.To(true), @@ -428,10 +428,6 @@ func createSgCluster(ctx context.Context, comp *vshnv1.VSHNPostgreSQL, svc *runt }, } - if !comp.Spec.Parameters.Service.DisablePgBouncer { - sgCluster.Spec.Pods.DisableConnectionPooling = ptr.To(true) - } - TLSSettings := &sgv1.SGClusterSpecPostgresSsl{ Enabled: &comp.Spec.Parameters.Service.TLS.Enabled, } diff --git a/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy_test.go b/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy_test.go index 9b494ed15..10ad2f708 100644 --- a/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy_test.go +++ b/pkg/comp-functions/functions/vshnpostgres/postgresql_deploy_test.go @@ -66,6 +66,7 @@ func TestPostgreSqlDeploy(t *testing.T) { assert.Equal(t, "sgbackup-"+comp.GetName(), backups[0].SgObjectStorage) assert.Equal(t, comp.Spec.Parameters.Backup.Schedule, *(backups[0].CronSchedule)) assert.Equal(t, comp.Spec.Parameters.Backup.Retention, *(backups[0].Retention)) + assert.Equal(t, comp.Spec.Parameters.Service.DisablePgBouncer, *cluster.Spec.Pods.DisableConnectionPooling) sgInstanceProfile := &sgv1.SGInstanceProfile{} assert.NoError(t, svc.GetDesiredKubeObject(sgInstanceProfile, "profile"))