Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kuma-cp) Limit number of postgres connection by default #2866

Merged
merged 3 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -288,6 +288,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