diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index 02f1c9930..059b453ad 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -153,21 +153,22 @@ type LogicalBackup struct { // Operator options for connection pooler type ConnectionPooler struct { - NumberOfInstances *int32 `name:"connection_pooler_number_of_instances" default:"2"` - Schema string `name:"connection_pooler_schema" default:"pooler"` - User string `name:"connection_pooler_user" default:"pooler"` - Image string `name:"connection_pooler_image" default:"ghcr.io/zalando/postgres-operator/pgbouncer:latest"` - Mode string `name:"connection_pooler_mode" default:"transaction"` - MaxDBConnections *int32 `name:"connection_pooler_max_db_connections" default:"60"` - ConnectionPoolerDefaultCPURequest string `name:"connection_pooler_default_cpu_request"` - ConnectionPoolerDefaultMemoryRequest string `name:"connection_pooler_default_memory_request"` - ConnectionPoolerDefaultCPULimit string `name:"connection_pooler_default_cpu_limit"` - ConnectionPoolerDefaultMemoryLimit string `name:"connection_pooler_default_memory_limit"` - GenerateConfig bool `name:"connection_pooler_generate_config" default:"false"` - Command []string `name:"connection_pooler_command"` - Args []string `name:"connection_pooler_args" default:"/etc/pgbouncer/pgbouncer.ini"` - AuthType string `name:"connection_pooler_auth_type" default:"scram-sha-256"` - ConfigPath string `name:"connection_pooler_config_path" default:"/etc/pgbouncer/pgbouncer.ini"` + NumberOfInstances *int32 `name:"connection_pooler_number_of_instances" default:"2"` + Schema string `name:"connection_pooler_schema" default:"pooler"` + User string `name:"connection_pooler_user" default:"pooler"` + Image string `name:"connection_pooler_image" default:"ghcr.io/zalando/postgres-operator/pgbouncer:latest"` + Mode string `name:"connection_pooler_mode" default:"transaction"` + MaxDBConnections *int32 `name:"connection_pooler_max_db_connections" default:"60"` + ConnectionPoolerDefaultCPURequest string `name:"connection_pooler_default_cpu_request"` + ConnectionPoolerDefaultMemoryRequest string `name:"connection_pooler_default_memory_request"` + ConnectionPoolerDefaultCPULimit string `name:"connection_pooler_default_cpu_limit"` + ConnectionPoolerDefaultMemoryLimit string `name:"connection_pooler_default_memory_limit"` + GenerateConfig bool `name:"connection_pooler_generate_config" default:"false"` + // Command is nil when not configured (keeps the image entrypoint). + Command []string `name:"connection_pooler_command"` + Args []string `name:"connection_pooler_args" default:"/etc/pgbouncer/pgbouncer.ini"` + AuthType string `name:"connection_pooler_auth_type" default:"scram-sha-256"` + ConfigPath string `name:"connection_pooler_config_path" default:"/etc/pgbouncer/pgbouncer.ini"` } // Config describes operator config diff --git a/pkg/util/config/config_test.go b/pkg/util/config/config_test.go index c5f7a2dac..dac647e6b 100644 --- a/pkg/util/config/config_test.go +++ b/pkg/util/config/config_test.go @@ -356,6 +356,8 @@ func TestConnectionPoolerGenerateConfigDefaults(t *testing.T) { "connection_pooler_generate_config": "true", "connection_pooler_auth_type": "md5", "connection_pooler_args": "/custom/pgbouncer.ini", + "connection_pooler_config_path": "/custom/pgbouncer.ini", + "connection_pooler_command": "/usr/bin/pgbouncer", }) if !cfg2.ConnectionPooler.GenerateConfig { t.Errorf("expected GenerateConfig true") @@ -366,4 +368,10 @@ func TestConnectionPoolerGenerateConfigDefaults(t *testing.T) { if len(cfg2.ConnectionPooler.Args) != 1 || cfg2.ConnectionPooler.Args[0] != "/custom/pgbouncer.ini" { t.Errorf("expected Args [/custom/pgbouncer.ini], got %#v", cfg2.ConnectionPooler.Args) } + if cfg2.ConnectionPooler.ConfigPath != "/custom/pgbouncer.ini" { + t.Errorf("expected ConfigPath /custom/pgbouncer.ini, got %q", cfg2.ConnectionPooler.ConfigPath) + } + if len(cfg2.ConnectionPooler.Command) != 1 || cfg2.ConnectionPooler.Command[0] != "/usr/bin/pgbouncer" { + t.Errorf("expected Command [/usr/bin/pgbouncer], got %#v", cfg2.ConnectionPooler.Command) + } }