@@ -35,22 +35,22 @@ import (
35
35
)
36
36
37
37
const (
38
- minioServiceHost = "MINIO_SERVICE_SERVICE_HOST"
39
- minioServicePort = "MINIO_SERVICE_SERVICE_PORT"
40
- minioServiceRegion = "MINIO_SERVICE_REGION"
41
- minioServiceSecure = "MINIO_SERVICE_SECURE"
42
- pipelineBucketName = "MINIO_PIPELINE_BUCKET_NAME"
43
- pipelinePath = "MINIO_PIPELINE_PATH"
44
- mysqlServiceHost = "DBConfig.Host"
45
- mysqlServicePort = "DBConfig.Port"
46
- mysqlUser = "DBConfig.User"
47
- mysqlPassword = "DBConfig.Password"
48
- mysqlDBName = "DBConfig.DBName"
49
- mysqlGroupConcatMaxLen = "DBConfig.GroupConcatMaxLen"
50
- mysqlExtraParams = "DBConfig.ExtraParams"
51
- archiveLogFileName = "ARCHIVE_LOG_FILE_NAME"
52
- archiveLogPathPrefix = "ARCHIVE_LOG_PATH_PREFIX"
53
- dbConMaxLifeTime = "DBConfig.ConMaxLifeTime"
38
+ objectStoreServiceHost = "MINIO_SERVICE_SERVICE_HOST"
39
+ objectStoreServicePort = "MINIO_SERVICE_SERVICE_PORT"
40
+ objectStoreServiceRegion = "MINIO_SERVICE_REGION"
41
+ objectStoreServiceSecure = "MINIO_SERVICE_SECURE"
42
+ pipelineBucketName = "MINIO_PIPELINE_BUCKET_NAME"
43
+ pipelinePath = "MINIO_PIPELINE_PATH"
44
+ mysqlServiceHost = "DBConfig.Host"
45
+ mysqlServicePort = "DBConfig.Port"
46
+ mysqlUser = "DBConfig.User"
47
+ mysqlPassword = "DBConfig.Password"
48
+ mysqlDBName = "DBConfig.DBName"
49
+ mysqlGroupConcatMaxLen = "DBConfig.GroupConcatMaxLen"
50
+ mysqlExtraParams = "DBConfig.ExtraParams"
51
+ archiveLogFileName = "ARCHIVE_LOG_FILE_NAME"
52
+ archiveLogPathPrefix = "ARCHIVE_LOG_PATH_PREFIX"
53
+ dbConMaxLifeTime = "DBConfig.ConMaxLifeTime"
54
54
55
55
visualizationServiceHost = "ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_HOST"
56
56
visualizationServicePort = "ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_PORT"
@@ -175,7 +175,7 @@ func (c *ClientManager) init() {
175
175
c .resourceReferenceStore = storage .NewResourceReferenceStore (db )
176
176
c .dBStatusStore = storage .NewDBStatusStore (db )
177
177
c .defaultExperimentStore = storage .NewDefaultExperimentStore (db )
178
- c .objectStore = initMinioClient (common .GetDurationConfig (initConnectionTimeout ))
178
+ c .objectStore = initObjectStoreClient (common .GetDurationConfig (initConnectionTimeout ))
179
179
180
180
// Use default value of client QPS (5) & burst (10) defined in
181
181
// k8s.io/client-go/rest/config.go#RESTClientFor
@@ -381,32 +381,32 @@ func initMysql(driverName string, initConnectionTimeout time.Duration) string {
381
381
return mysqlConfig .FormatDSN ()
382
382
}
383
383
384
- func initMinioClient (initConnectionTimeout time.Duration ) storage.ObjectStoreInterface {
385
- // Create minio client.
386
- minioServiceHost := common .GetStringConfigWithDefault (
387
- "ObjectStoreConfig.Host" , os .Getenv (minioServiceHost ))
388
- minioServicePort := common .GetStringConfigWithDefault (
389
- "ObjectStoreConfig.Port" , os .Getenv (minioServicePort ))
390
- minioServiceRegion := common .GetStringConfigWithDefault (
391
- "ObjectStoreConfig.Region" , os .Getenv (minioServiceRegion ))
392
- minioServiceSecure := common .GetBoolConfigWithDefault (
393
- "ObjectStoreConfig.Secure" , common .GetBoolFromStringWithDefault (os .Getenv (minioServiceSecure ), false ))
384
+ func initObjectStoreClient (initConnectionTimeout time.Duration ) storage.ObjectStoreInterface {
385
+ // Create client.
386
+ objectStoreServiceHost := common .GetStringConfigWithDefault (
387
+ "ObjectStoreConfig.Host" , os .Getenv (objectStoreServiceHost ))
388
+ objectStoreServicePort := common .GetStringConfigWithDefault (
389
+ "ObjectStoreConfig.Port" , os .Getenv (objectStoreServicePort ))
390
+ objectStoreServiceRegion := common .GetStringConfigWithDefault (
391
+ "ObjectStoreConfig.Region" , os .Getenv (objectStoreServiceRegion ))
392
+ objectStoreServiceSecure := common .GetBoolConfigWithDefault (
393
+ "ObjectStoreConfig.Secure" , common .GetBoolFromStringWithDefault (os .Getenv (objectStoreServiceSecure ), false ))
394
394
accessKey := common .GetStringConfigWithDefault ("ObjectStoreConfig.AccessKey" , "" )
395
395
secretKey := common .GetStringConfigWithDefault ("ObjectStoreConfig.SecretAccessKey" , "" )
396
396
bucketName := common .GetStringConfigWithDefault ("ObjectStoreConfig.BucketName" , os .Getenv (pipelineBucketName ))
397
397
pipelinePath := common .GetStringConfigWithDefault ("ObjectStoreConfig.PipelinePath" , os .Getenv (pipelinePath ))
398
398
disableMultipart := common .GetBoolConfigWithDefault ("ObjectStoreConfig.Multipart.Disable" , true )
399
399
400
- minioClient := client .CreateMinioClientOrFatal ( minioServiceHost , minioServicePort , accessKey ,
401
- secretKey , minioServiceSecure , minioServiceRegion , initConnectionTimeout )
402
- createMinioBucket ( minioClient , bucketName , minioServiceRegion )
400
+ client := client .CreateObjectStoreClientOrFatal ( objectStoreServiceHost , objectStoreServicePort , accessKey ,
401
+ secretKey , objectStoreServiceSecure , objectStoreServiceRegion , initConnectionTimeout )
402
+ createBucket ( client , bucketName , objectStoreServiceRegion )
403
403
404
- return storage .NewMinioObjectStore (& storage.MinioClient {Client : minioClient }, bucketName , pipelinePath , disableMultipart )
404
+ return storage .NewMinioObjectStore (& storage.MinioClient {Client : client }, bucketName , pipelinePath , disableMultipart )
405
405
}
406
406
407
- func createMinioBucket ( minioClient * minio.Client , bucketName , region string ) {
407
+ func createBucket ( client * minio.Client , bucketName , region string ) {
408
408
// Check to see if we already own this bucket.
409
- exists , err := minioClient .BucketExists (bucketName )
409
+ exists , err := client .BucketExists (bucketName )
410
410
if err != nil {
411
411
glog .Fatalf ("Failed to check if Minio bucket exists. Error: %v" , err )
412
412
}
@@ -415,7 +415,7 @@ func createMinioBucket(minioClient *minio.Client, bucketName, region string) {
415
415
return
416
416
}
417
417
// Create bucket if it does not exist
418
- err = minioClient .MakeBucket (bucketName , region )
418
+ err = client .MakeBucket (bucketName , region )
419
419
if err != nil {
420
420
glog .Fatalf ("Failed to create Minio bucket. Error: %v" , err )
421
421
}
0 commit comments