Skip to content

Commit

Permalink
Fix wrong pgbouncer toggle
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
Kidswiss authored and wejdross committed Dec 16, 2024
1 parent 2609178 commit 25f8995
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 25f8995

Please sign in to comment.