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

chore: add meaningful logs to client initialization. #10801

Merged
merged 1 commit into from
May 9, 2024
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
4 changes: 2 additions & 2 deletions backend/src/apiserver/client/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func CreateMinioClient(minioServiceHost string, minioServicePort string,
cred := createCredentialProvidersChain(endpoint, accessKey, secretKey)
minioClient, err := minio.NewWithCredentials(endpoint, cred, secure, region)
if err != nil {
return nil, errors.Wrapf(err, "Error while creating minio client: %+v", err)
return nil, errors.Wrapf(err, "Error while creating object store client: %+v", err)
}
return minioClient, nil
}
Expand All @@ -74,7 +74,7 @@ func CreateMinioClientOrFatal(minioServiceHost string, minioServicePort string,
b.MaxElapsedTime = initConnectionTimeout
err = backoff.Retry(operation, b)
if err != nil {
glog.Fatalf("Failed to create Minio client. Error: %v", err)
glog.Fatalf("Failed to create object store client. Error: %v", err)
}
return minioClient
}
Expand Down
12 changes: 7 additions & 5 deletions backend/src/apiserver/client_manager/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ func (c *ClientManager) Authenticators() []auth.Authenticator {

func (c *ClientManager) init() {
glog.Info("Initializing client manager")
glog.Info("Initializing DB client...")
db := InitDBClient(common.GetDurationConfig(initConnectionTimeout))
db.SetConnMaxLifetime(common.GetDurationConfig(dbConMaxLifeTime))

glog.Info("DB client initialized successfully")
// time
c.time = util.NewRealTime()

Expand All @@ -185,8 +186,9 @@ func (c *ClientManager) init() {
c.resourceReferenceStore = storage.NewResourceReferenceStore(db)
c.dBStatusStore = storage.NewDBStatusStore(db)
c.defaultExperimentStore = storage.NewDefaultExperimentStore(db)
glog.Info("Initializing Object store client...")
c.objectStore = initMinioClient(common.GetDurationConfig(initConnectionTimeout))

glog.Info("Object store client initialized successfully")
// Use default value of client QPS (5) & burst (10) defined in
// k8s.io/client-go/rest/config.go#RESTClientFor
clientParams := util.ClientParameters{
Expand Down Expand Up @@ -494,10 +496,10 @@ func initMinioClient(initConnectionTimeout time.Duration) storage.ObjectStoreInt
}

func createMinioBucket(minioClient *minio.Client, bucketName, region string) {
// Check to see if we already own this bucket.
// Check to see if it exists, and we have permission to access it.
exists, err := minioClient.BucketExists(bucketName)
if err != nil {
glog.Fatalf("Failed to check if Minio bucket exists. Error: %v", err)
glog.Fatalf("Failed to check if object store bucket exists. Error: %v", err)
}
if exists {
glog.Infof("We already own %s\n", bucketName)
Expand All @@ -506,7 +508,7 @@ func createMinioBucket(minioClient *minio.Client, bucketName, region string) {
// Create bucket if it does not exist
err = minioClient.MakeBucket(bucketName, region)
if err != nil {
glog.Fatalf("Failed to create Minio bucket. Error: %v", err)
glog.Fatalf("Failed to create object store bucket. Error: %v", err)
}
glog.Infof("Successfully created bucket %s\n", bucketName)
}
Expand Down
Loading