Skip to content

Commit

Permalink
fix(kuma-cp) limit number of postgres connection by default (#2866)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
  • Loading branch information
mergify[bot] authored Oct 5, 2021
1 parent 797ca41 commit 3b8504b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/api-server/config_ws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ var _ = Describe("Config WS", func() {
"port": 15432,
"maxReconnectInterval": "1m0s",
"minReconnectInterval": "10s",
"maxIdleConnections": 50,
"maxOpenConnections": 50,
"tls": {
"certPath": "",
"keyPath": "",
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/app/kuma-cp/kuma-cp.defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ store:
connectionTimeout: 5 # ENV: KUMA_STORE_POSTGRES_CONNECTION_TIMEOUT
# Maximum number of open connections to the database
# `0` value means number of open connections is unlimited
maxOpenConnections: 0 # ENV: KUMA_STORE_POSTGRES_MAX_OPEN_CONNECTIONS
maxOpenConnections: 50 # ENV: KUMA_STORE_POSTGRES_MAX_OPEN_CONNECTIONS
# Maximum number of connections in the idle connection pool
# <0 value means no idle connections and 0 means default max idle connections
maxIdleConnections: 0 # ENV: KUMA_STORE_POSTGRES_MAX_IDLE_CONNECTIONS
maxIdleConnections: 50 # ENV: KUMA_STORE_POSTGRES_MAX_IDLE_CONNECTIONS
# TLS settings
tls:
# Mode of TLS connection. Available values (disable, verifyNone, verifyCa, verifyFull)
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/plugins/resources/postgres/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func DefaultPostgresStoreConfig() *PostgresStoreConfig {
Password: "kuma",
DbName: "kuma",
ConnectionTimeout: 5,
MaxOpenConnections: 0, // number of open connections is unlimited
MaxOpenConnections: 50, // 0 for unlimited
MaxIdleConnections: 50, // 0 for unlimited
TLS: DefaultTLSPostgresStoreConfig(),
MinReconnectInterval: 10 * time.Second,
MaxReconnectInterval: 60 * time.Second,
Expand Down

0 comments on commit 3b8504b

Please sign in to comment.