Skip to content

Commit

Permalink
Let backend apiserver mysql dbname configurable (kubeflow#1714)
Browse files Browse the repository at this point in the history
* let mysql dbname configurable

* solve conflict

* move declaration out to fix scope
  • Loading branch information
jwwandy authored and k8s-ci-robot committed Aug 20, 2019
1 parent 101a346 commit 60fd70c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
15 changes: 8 additions & 7 deletions backend/src/apiserver/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ import (
)

const (
minioServiceHost = "MINIO_SERVICE_SERVICE_HOST"
minioServicePort = "MINIO_SERVICE_SERVICE_PORT"
mysqlServiceHost = "MYSQL_SERVICE_HOST"
mysqlUser = "DBConfig.User"
mysqlPassword = "DBConfig.Password"
mysqlServicePort = "MYSQL_SERVICE_PORT"
minioServiceHost = "MINIO_SERVICE_SERVICE_HOST"
minioServicePort = "MINIO_SERVICE_SERVICE_PORT"
mysqlServiceHost = "MYSQL_SERVICE_HOST"
mysqlServicePort = "MYSQL_SERVICE_PORT"
mysqlUser = "DBConfig.User"
mysqlPassword = "DBConfig.Password"
mysqlDBName = "DBConfig.DBName"

podNamespace = "POD_NAMESPACE"
dbName = "mlpipeline"
initConnectionTimeout = "InitConnectionTimeout"
)

Expand Down Expand Up @@ -255,6 +255,7 @@ func initMysql(driverName string, initConnectionTimeout time.Duration) string {
util.TerminateIfError(err)

// Create database if not exist
dbName := getStringConfig(mysqlDBName)
operation = func() error {
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", dbName))
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion backend/src/apiserver/config/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"DBConfig": {
"DriverName": "mysql",
"DataSourceName": ""
"DataSourceName": "",
"DBName": "mlpipeline"
},
"ObjectStoreConfig":{
"AccessKey": "minio",
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ require (
github.com/google/uuid v1.0.0
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/websocket v1.4.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.6.3
github.com/hashicorp/golang-lru v0.5.3 // indirect
Expand Down
8 changes: 8 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 60fd70c

Please sign in to comment.