Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 017afd3

Browse files
committed
Remove bucket creation and retry logic
Operator will now assume that the bucket exists and fail on runtime if not.
1 parent 003522d commit 017afd3

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

operator/controllers/execution/scan_controller.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -762,30 +762,9 @@ func (r *ScanReconciler) initS3Connection() *minio.Client {
762762
}
763763

764764
// Initialize minio client object.
765-
var minioClient *minio.Client
766-
const maxRetries = 5
767-
for i := 0; i < maxRetries; i++ {
768-
client, err := minio.New(fmt.Sprintf("%s:%s", endpoint, port), accessKeyID, secretAccessKey, useSSL)
769-
if err == nil {
770-
r.Log.Info("Created minio client")
771-
minioClient = client
772-
break
773-
}
774-
775-
if i < maxRetries-1 {
776-
r.Log.Info("Could not create minio client to communicate to s3 endpoint", "retiresLeft", maxRetries-i)
777-
time.Sleep(5 * time.Second)
778-
} else {
779-
r.Log.Error(err, "S3 Client init failed repeatedly. Process will exit.")
780-
panic(err)
781-
}
782-
}
783-
784-
bucketName := os.Getenv("S3_BUCKET")
785-
786-
bucketExists, err := minioClient.BucketExists(bucketName)
787-
if err != nil || bucketExists == false {
788-
r.Log.Error(err, "Could not communicate with s3 or compatible storage provider")
765+
minioClient, err := minio.New(fmt.Sprintf("%s:%s", endpoint, port), accessKeyID, secretAccessKey, useSSL)
766+
if err != nil {
767+
r.Log.Error(err, "Could not create minio client to communicate with s3 or compatible storage provider")
789768
panic(err)
790769
}
791770

0 commit comments

Comments
 (0)