support multisite replication setup (#1072)

This commit is contained in:
Harshavardhana
2021-09-22 12:04:27 -07:00
committed by GitHub
parent 4cdb862ae6
commit 2e300dba7d

View File

@@ -269,7 +269,7 @@ func addRemoteBucket(ctx context.Context, client MinioAdmin, params models.Creat
return bucketARN, err 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 // we will tolerate this call failing
cfg, err := minClient.getBucketReplication(ctx, bucketName) cfg, err := minClient.getBucketReplication(ctx, bucketName)
if err != nil { if err != nil {
@@ -310,15 +310,15 @@ func addBucketReplicationItem(ctx context.Context, session *models.Principal, mi
} }
opts := replication.Options{ opts := replication.Options{
RoleArn: arn, Priority: fmt.Sprintf("%d", maxPrio),
Priority: fmt.Sprintf("%d", maxPrio), RuleStatus: "enable",
RuleStatus: "enable", DestBucket: destinationARN,
DestBucket: destinationBucket, Op: replication.AddOption,
Op: replication.AddOption, TagString: tags,
TagString: tags, ExistingObjectReplicate: "enable", // enabled by default
ReplicateDeleteMarkers: repDelMarkStatus, ReplicateDeleteMarkers: repDelMarkStatus,
ReplicateDeletes: repDelsStatus, ReplicateDeletes: repDelsStatus,
ReplicaSync: repMetaStatus, ReplicaSync: repMetaStatus,
} }
err2 := mcClient.setReplication(ctx, &cfg, opts) err2 := mcClient.setReplication(ctx, &cfg, opts)
@@ -363,7 +363,6 @@ func setMultiBucketReplication(ctx context.Context, session *models.Principal, c
sourceBucket, sourceBucket,
params.Body.Prefix, params.Body.Prefix,
arn, arn,
targetBucket,
params.Body.ReplicateDeleteMarkers, params.Body.ReplicateDeleteMarkers,
params.Body.ReplicateDeletes, params.Body.ReplicateDeletes,
params.Body.ReplicateMetadata, params.Body.ReplicateMetadata,