Skip to content

Commit bbd2cff

Browse files
krithika369Krithika Sundararajan
andauthored
Add DB connection configs (#312)
* Add DB connection config * Apply SQL connection defaults * Update chart * Remove default config --------- Co-authored-by: Krithika Sundararajan <[email protected]>
1 parent 25be214 commit bbd2cff

File tree

10 files changed

+77
-32
lines changed

10 files changed

+77
-32
lines changed

api/go.mod

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
github.com/pkg/errors v0.9.1
3434
github.com/rs/cors v1.8.2
3535
github.com/stretchr/testify v1.8.0
36-
github.com/xanzy/go-gitlab v0.31.0
36+
github.com/xanzy/go-gitlab v0.32.0
3737
go.uber.org/zap v1.21.0
3838
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c
3939
google.golang.org/grpc v1.50.1
@@ -46,9 +46,9 @@ require (
4646
gotest.tools/v3 v3.0.3
4747
istio.io/api v0.0.0-20220304035241-8c47cbbea144
4848
istio.io/client-go v1.12.5
49-
k8s.io/api v0.22.7
50-
k8s.io/apimachinery v0.22.7
51-
k8s.io/client-go v0.22.7
49+
k8s.io/api v0.23.4
50+
k8s.io/apimachinery v0.23.4
51+
k8s.io/client-go v0.23.4
5252
knative.dev/pkg v0.0.0-20220222221138-929d328ad73c
5353
knative.dev/serving v0.27.2
5454
sigs.k8s.io/yaml v1.3.0
@@ -65,7 +65,7 @@ require (
6565
github.com/buger/jsonparser v1.1.1 // indirect
6666
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 // indirect
6767
github.com/cespare/xxhash v1.1.0 // indirect
68-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
68+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
6969
github.com/davecgh/go-spew v1.1.1 // indirect
7070
github.com/dgraph-io/ristretto v0.0.1 // indirect
7171
github.com/docker/cli v20.10.12+incompatible // indirect
@@ -104,7 +104,7 @@ require (
104104
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.2 // indirect
105105
github.com/hashicorp/errwrap v1.0.0 // indirect
106106
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
107-
github.com/hashicorp/go-hclog v1.0.0 // indirect
107+
github.com/hashicorp/go-hclog v0.16.0 // indirect
108108
github.com/hashicorp/go-multierror v1.1.1 // indirect
109109
github.com/hashicorp/go-plugin v1.4.3 // indirect
110110
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
@@ -128,22 +128,22 @@ require (
128128
github.com/jinzhu/inflection v1.0.0 // indirect
129129
github.com/jinzhu/now v1.1.5 // indirect
130130
github.com/josharian/intern v1.0.0 // indirect
131-
github.com/json-iterator/go v1.1.12 // indirect
131+
github.com/json-iterator/go v1.1.11 // indirect
132132
github.com/kelseyhightower/envconfig v1.4.0 // indirect
133133
github.com/klauspost/compress v1.15.9 // indirect
134134
github.com/leodido/go-urn v1.2.1 // indirect
135135
github.com/lib/pq v1.10.3 // indirect
136136
github.com/magiconair/properties v1.8.5 // indirect
137137
github.com/mailru/easyjson v0.7.7 // indirect
138-
github.com/mattn/go-colorable v0.1.12 // indirect
138+
github.com/mattn/go-colorable v0.1.11 // indirect
139139
github.com/mattn/go-isatty v0.0.14 // indirect
140140
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
141141
github.com/mitchellh/go-homedir v1.1.0 // indirect
142142
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
143143
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
144144
github.com/mitchellh/reflectwalk v1.0.2 // indirect
145145
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
146-
github.com/modern-go/reflect2 v1.0.2 // indirect
146+
github.com/modern-go/reflect2 v1.0.1 // indirect
147147
github.com/newrelic/go-agent v3.19.2+incompatible // indirect
148148
github.com/oklog/run v1.0.0 // indirect
149149
github.com/opencontainers/go-digest v1.0.0 // indirect
@@ -193,7 +193,7 @@ require (
193193
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
194194
gopkg.in/errgo.v2 v2.1.0 // indirect
195195
gopkg.in/inf.v0 v0.9.1 // indirect
196-
gopkg.in/ini.v1 v1.66.2 // indirect
196+
gopkg.in/ini.v1 v1.63.2 // indirect
197197
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
198198
istio.io/gogo-genproto v0.0.0-20210113155706-4daf5697332f // indirect
199199
k8s.io/klog/v2 v2.9.0 // indirect

api/go.sum

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,8 @@ github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5P
258258
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
259259
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
260260
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
261+
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
261262
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
262-
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
263-
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
264263
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
265264
github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg=
266265
github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3//PWVzTeCezG2b9IRn6myJxJSr4TD/xo6ojU=
@@ -938,9 +937,8 @@ github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrj
938937
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
939938
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
940939
github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
940+
github.com/hashicorp/go-hclog v0.16.0 h1:uCeOEwSWGMwhJUdpUjk+1cVKIEfGu2/1nFXukimi2MU=
941941
github.com/hashicorp/go-hclog v0.16.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
942-
github.com/hashicorp/go-hclog v1.0.0 h1:bkKf0BeBXcSYa7f5Fyi9gMuQ8gNsxeiNpZjR6VxNZeo=
943-
github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
944942
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
945943
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
946944
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
@@ -1103,9 +1101,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
11031101
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
11041102
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
11051103
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
1104+
github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
11061105
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
1107-
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
1108-
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
11091106
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
11101107
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
11111108
github.com/jtolds/gls v0.0.0-20170503224851-77f18212c9c7/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
@@ -1209,9 +1206,8 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
12091206
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
12101207
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
12111208
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
1209+
github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs=
12121210
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
1213-
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
1214-
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
12151211
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
12161212
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
12171213
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@@ -1292,9 +1288,8 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
12921288
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
12931289
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
12941290
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
1291+
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
12951292
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
1296-
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
1297-
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
12981293
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
12991294
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
13001295
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
@@ -1726,8 +1721,9 @@ github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqI
17261721
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
17271722
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
17281723
github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs=
1729-
github.com/xanzy/go-gitlab v0.31.0 h1:+nHztQuCXGSMluKe5Q9IRaPdz6tO8O0gMkQ0vqGpiBk=
17301724
github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
1725+
github.com/xanzy/go-gitlab v0.32.0 h1:tBm+OXv1t+KBsqlXkSDFz+YUjRM0GFsjpOWYOod3Ebs=
1726+
github.com/xanzy/go-gitlab v0.32.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
17311727
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
17321728
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
17331729
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
@@ -2524,9 +2520,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
25242520
gopkg.in/ini.v1 v1.37.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
25252521
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
25262522
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
2523+
gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c=
25272524
gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
2528-
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
2529-
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
25302525
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
25312526
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
25322527
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=

api/turing/config/config.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,18 @@ type SinglePageApplicationConfig struct {
248248

249249
// DatabaseConfig config captures the Turing database config
250250
type DatabaseConfig struct {
251-
Host string `validate:"required"`
252-
Port int `validate:"required"`
253-
User string `validate:"required"`
254-
Password string `validate:"required"`
255-
Database string `validate:"required"`
251+
Host string `validate:"required"`
252+
Port int `validate:"required"`
253+
User string `validate:"required"`
254+
Password string `validate:"required"`
255+
Database string `validate:"required"`
256+
256257
MigrationsFolder string `validate:"required"`
258+
259+
ConnMaxIdleTime time.Duration
260+
ConnMaxLifetime time.Duration
261+
MaxIdleConns int
262+
MaxOpenConns int
257263
}
258264

259265
type ExperimentEngineConfig struct {

api/turing/config/config_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ func setupNewEnv(envMaps ...map[string]string) {
114114

115115
func TestLoad(t *testing.T) {
116116
blueSvcAcctKeyFilePath := "/etc/plugins/blue/gcp_service_account/service-account.json"
117+
zeroSecond, _ := time.ParseDuration("0s")
118+
oneSecond, _ := time.ParseDuration("1s")
119+
twoSecond, _ := time.ParseDuration("2s")
117120

118121
tests := map[string]struct {
119122
filepaths []string
@@ -131,6 +134,10 @@ func TestLoad(t *testing.T) {
131134
Port: 5432,
132135
Database: "turing",
133136
MigrationsFolder: "db-migrations/",
137+
ConnMaxIdleTime: zeroSecond,
138+
ConnMaxLifetime: zeroSecond,
139+
MaxIdleConns: 0,
140+
MaxOpenConns: 0,
134141
},
135142
DeployConfig: &config.DeploymentConfig{
136143
Timeout: 3 * time.Minute,
@@ -197,6 +204,10 @@ func TestLoad(t *testing.T) {
197204
Password: "dbpassword",
198205
Database: "turing",
199206
MigrationsFolder: "db-migrations/",
207+
ConnMaxIdleTime: oneSecond,
208+
ConnMaxLifetime: twoSecond,
209+
MaxIdleConns: 3,
210+
MaxOpenConns: 4,
200211
},
201212
DeployConfig: &config.DeploymentConfig{
202213
EnvironmentType: "dev",
@@ -284,6 +295,10 @@ func TestLoad(t *testing.T) {
284295
Password: "newpassword",
285296
Database: "turing",
286297
MigrationsFolder: "db-migrations/",
298+
ConnMaxIdleTime: oneSecond,
299+
ConnMaxLifetime: twoSecond,
300+
MaxIdleConns: 3,
301+
MaxOpenConns: 4,
287302
},
288303
DeployConfig: &config.DeploymentConfig{
289304
EnvironmentType: "dev",
@@ -405,6 +420,10 @@ func TestLoad(t *testing.T) {
405420
Password: "dbpassword-env",
406421
Database: "turing",
407422
MigrationsFolder: "db-migrations/",
423+
ConnMaxIdleTime: oneSecond,
424+
ConnMaxLifetime: twoSecond,
425+
MaxIdleConns: 3,
426+
MaxOpenConns: 4,
408427
},
409428
KnativeServiceDefaults: &config.KnativeServiceDefaults{
410429
QueueProxyResourcePercentage: 20,

api/turing/config/testdata/config-1.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ DbConfig:
99
Host: "127.0.0.1"
1010
User: dbuser
1111
Password: dbpassword
12+
ConnMaxIdleTime: 1s
13+
ConnMaxLifetime: 2s
14+
MaxIdleConns: 3
15+
MaxOpenConns: 4
1216
DeployConfig:
1317
EnvironmentType: dev
1418
Timeout: 5m

api/turing/database/database.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,20 @@ func InitDB(cfg *config.DatabaseConfig) (*gorm.DB, error) {
3131
Logger: logger.Default.LogMode(logger.Silent),
3232
},
3333
)
34-
3534
if err != nil {
3635
return nil, fmt.Errorf("Failed to start Gorm DB: %s", err)
3736
}
3837

38+
// Get the underlying SQL DB and apply connection properties
39+
sqlDB, err := db.DB()
40+
if err != nil {
41+
return nil, err
42+
}
43+
sqlDB.SetConnMaxIdleTime(cfg.ConnMaxIdleTime)
44+
sqlDB.SetConnMaxLifetime(cfg.ConnMaxLifetime)
45+
sqlDB.SetMaxIdleConns(cfg.MaxIdleConns)
46+
sqlDB.SetMaxOpenConns(cfg.MaxOpenConns)
47+
3948
return db, nil
4049
}
4150

infra/charts/turing/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
22
description: "Turing: ML Experimentation System"
33
name: turing
4-
version: 0.2.15
4+
version: 0.2.16
55
appVersion: v1.0.0

infra/charts/turing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# turing
22

33
---
4-
![Version: 0.2.15](https://img.shields.io/badge/Version-0.2.15-informational?style=flat-square)
4+
![Version: 0.2.16](https://img.shields.io/badge/Version-0.2.16-informational?style=flat-square)
55
![AppVersion: v1.0.0](https://img.shields.io/badge/AppVersion-v1.0.0-informational?style=flat-square)
66

77
Turing: ML Experimentation System

infra/charts/turing/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ DbConfig:
171171
Database: {{ include "turing.db.database" . }}
172172
User: {{ include "turing.db.user" . }}
173173
Password: {{ include "turing.db.password" . }}
174+
ConnMaxIdleTime: {{ .Values.turing.config.DbConfig.ConnMaxIdleTime }}
175+
ConnMaxLifetime: {{ .Values.turing.config.DbConfig.ConnMaxLifetime }}
176+
MaxIdleConns: {{ .Values.turing.config.DbConfig.MaxIdleConns }}
177+
MaxOpenConns: {{ .Values.turing.config.DbConfig.MaxOpenConns }}
174178
DeployConfig:
175179
EnvironmentType: {{ .Values.turing.config.DeployConfig.EnvironmentType | default (include "turing.environment" .) }}
176180
KubernetesLabelConfigs:

infra/charts/turing/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,15 @@ turing:
151151
PythonVersion: "3"
152152
TTLSecond: 86400
153153
DeployConfig: { }
154-
DbConfig: { }
154+
DbConfig:
155+
# The maximum amount of time a connection may be idle. For more info see: https://pkg.go.dev/database/sql#DB.SetConnMaxIdleTime
156+
ConnMaxIdleTime: 0s
157+
# The maximum amount of time a connection may be reused. For more info see: https://pkg.go.dev/database/sql#DB.SetConnMaxLifetime
158+
ConnMaxLifetime: 0s
159+
# The maximum number of connections in the idle connection pool. For more info see: https://pkg.go.dev/database/sql#DB.SetMaxIdleConns
160+
MaxIdleConns: 0
161+
# The maximum number of open connections to the database. For more info see: https://pkg.go.dev/database/sql#DB.SetMaxOpenConns
162+
MaxOpenConns: 0
155163
KubernetesLabelConfigs: { }
156164
MLPConfig: { }
157165
Sentry:

0 commit comments

Comments
 (0)