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")) diff --git a/pkg/comp-functions/functions/vshnpostgres/restart.go b/pkg/comp-functions/functions/vshnpostgres/restart.go index bb3f11546..6c48fa36d 100644 --- a/pkg/comp-functions/functions/vshnpostgres/restart.go +++ b/pkg/comp-functions/functions/vshnpostgres/restart.go @@ -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 }