Skip to content

Commit

Permalink
Merge pull request #282 from vshn/fix/default_pgbouncer
Browse files Browse the repository at this point in the history
Fix wrong pgbouncer toggle
  • Loading branch information
wejdross authored Dec 16, 2024
2 parents 2609178 + c463aba commit 6efad7c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 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
2 changes: 1 addition & 1 deletion pkg/comp-functions/functions/vshnpostgres/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func keepRecentRestartOps(ctx context.Context, svc *runtime.ServiceRuntime, comp
continue
}

err = svc.SetDesiredKubeObject(&op, r.Resource.GetName())
err = svc.SetDesiredKubeObject(&op, r.Resource.GetName(), runtime.KubeOptionAllowDeletion)
if err != nil {
return err
}
Expand Down

0 comments on commit 6efad7c

Please sign in to comment.