From 2e300dba7df27f31f0c0f870598f648e99e2f826 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 22 Sep 2021 12:04:27 -0700 Subject: [PATCH] support multisite replication setup (#1072) --- restapi/admin_remote_buckets.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/restapi/admin_remote_buckets.go b/restapi/admin_remote_buckets.go index f21b1fccb..5eb8b21ac 100644 --- a/restapi/admin_remote_buckets.go +++ b/restapi/admin_remote_buckets.go @@ -269,7 +269,7 @@ func addRemoteBucket(ctx context.Context, client MinioAdmin, params models.Creat return bucketARN, err } -func addBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, bucketName, prefix, arn, destinationBucket string, repDelMark, repDels, repMeta bool, tags string) error { +func addBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, bucketName, prefix, destinationARN string, repDelMark, repDels, repMeta bool, tags string) error { // we will tolerate this call failing cfg, err := minClient.getBucketReplication(ctx, bucketName) if err != nil { @@ -310,15 +310,15 @@ func addBucketReplicationItem(ctx context.Context, session *models.Principal, mi } opts := replication.Options{ - RoleArn: arn, - Priority: fmt.Sprintf("%d", maxPrio), - RuleStatus: "enable", - DestBucket: destinationBucket, - Op: replication.AddOption, - TagString: tags, - ReplicateDeleteMarkers: repDelMarkStatus, - ReplicateDeletes: repDelsStatus, - ReplicaSync: repMetaStatus, + Priority: fmt.Sprintf("%d", maxPrio), + RuleStatus: "enable", + DestBucket: destinationARN, + Op: replication.AddOption, + TagString: tags, + ExistingObjectReplicate: "enable", // enabled by default + ReplicateDeleteMarkers: repDelMarkStatus, + ReplicateDeletes: repDelsStatus, + ReplicaSync: repMetaStatus, } err2 := mcClient.setReplication(ctx, &cfg, opts) @@ -363,7 +363,6 @@ func setMultiBucketReplication(ctx context.Context, session *models.Principal, c sourceBucket, params.Body.Prefix, arn, - targetBucket, params.Body.ReplicateDeleteMarkers, params.Body.ReplicateDeletes, params.Body.ReplicateMetadata,