Changed default Replicate Existing Objects behavior in MinIO UI (#3271)
Changed default Replicate Existing Objects behavior in UI - Fixed replicate existing objects configuration saving - Displayed full error message if error case ocurrs. - Changed wording for this feature & enabled by default this setting Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -292,7 +292,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, destinationARN string, repDelMark, repDels, repMeta bool, tags string, priority int32, storageClass string) error {
|
||||
func addBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, bucketName, prefix, destinationARN string, repExistingObj, repDelMark, repDels, repMeta bool, tags string, priority int32, storageClass string) error {
|
||||
// we will tolerate this call failing
|
||||
cfg, err := minClient.getBucketReplication(ctx, bucketName)
|
||||
if err != nil {
|
||||
@@ -337,13 +337,18 @@ func addBucketReplicationItem(ctx context.Context, session *models.Principal, mi
|
||||
repMetaStatus = "enable"
|
||||
}
|
||||
|
||||
existingRepStatus := "disable"
|
||||
if repExistingObj {
|
||||
existingRepStatus = "enable"
|
||||
}
|
||||
|
||||
opts := replication.Options{
|
||||
Priority: fmt.Sprintf("%d", maxPrio),
|
||||
RuleStatus: "enable",
|
||||
DestBucket: destinationARN,
|
||||
Op: replication.AddOption,
|
||||
TagString: tags,
|
||||
ExistingObjectReplicate: "enable", // enabled by default
|
||||
ExistingObjectReplicate: existingRepStatus,
|
||||
ReplicateDeleteMarkers: repDelMarkStatus,
|
||||
ReplicateDeletes: repDelsStatus,
|
||||
ReplicaSync: repMetaStatus,
|
||||
@@ -459,6 +464,7 @@ func setMultiBucketReplication(ctx context.Context, session *models.Principal, c
|
||||
sourceBucket,
|
||||
params.Body.Prefix,
|
||||
arn,
|
||||
params.Body.ReplicateExistingObjects,
|
||||
params.Body.ReplicateDeleteMarkers,
|
||||
params.Body.ReplicateDeletes,
|
||||
params.Body.ReplicateMetadata,
|
||||
|
||||
@@ -7230,6 +7230,9 @@ func init() {
|
||||
"replicateDeletes": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replicateExistingObjects": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replicateMetadata": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -16636,6 +16639,9 @@ func init() {
|
||||
"replicateDeletes": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replicateExistingObjects": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replicateMetadata": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -68,6 +68,9 @@ type MultiBucketReplication struct {
|
||||
// replicate deletes
|
||||
ReplicateDeletes bool `json:"replicateDeletes,omitempty"`
|
||||
|
||||
// replicate existing objects
|
||||
ReplicateExistingObjects bool `json:"replicateExistingObjects,omitempty"`
|
||||
|
||||
// replicate metadata
|
||||
ReplicateMetadata bool `json:"replicateMetadata,omitempty"`
|
||||
|
||||
|
||||
@@ -4222,6 +4222,8 @@ definitions:
|
||||
type: string
|
||||
tags:
|
||||
type: string
|
||||
replicateExistingObjects:
|
||||
type: boolean
|
||||
replicateDeleteMarkers:
|
||||
type: boolean
|
||||
replicateDeletes:
|
||||
|
||||
@@ -385,6 +385,7 @@ export interface MultiBucketReplication {
|
||||
healthCheckPeriod?: number;
|
||||
prefix?: string;
|
||||
tags?: string;
|
||||
replicateExistingObjects?: boolean;
|
||||
replicateDeleteMarkers?: boolean;
|
||||
replicateDeletes?: boolean;
|
||||
replicateMetadata?: boolean;
|
||||
|
||||
@@ -60,7 +60,7 @@ const AddBucketReplication = () => {
|
||||
const [repDeleteMarker, setRepDeleteMarker] = useState<boolean>(true);
|
||||
const [repDelete, setRepDelete] = useState<boolean>(true);
|
||||
const [metadataSync, setMetadataSync] = useState<boolean>(true);
|
||||
const [repExisting, setRepExisting] = useState<boolean>(false);
|
||||
const [repExisting, setRepExisting] = useState<boolean>(true);
|
||||
const [tags, setTags] = useState<string>("");
|
||||
const [replicationMode, setReplicationMode] = useState<"async" | "sync">(
|
||||
"async",
|
||||
@@ -124,8 +124,8 @@ const AddBucketReplication = () => {
|
||||
if (itemVal.errorString && itemVal.errorString !== "") {
|
||||
dispatch(
|
||||
setErrorSnackMessage({
|
||||
errorMessage: itemVal.errorString,
|
||||
detailedError: "There was an error",
|
||||
errorMessage: "There was an error",
|
||||
detailedError: itemVal.errorString,
|
||||
}),
|
||||
);
|
||||
// navigate(backLink);
|
||||
@@ -201,11 +201,10 @@ const AddBucketReplication = () => {
|
||||
</Box>
|
||||
<Box sx={{ paddingTop: "10px" }}>
|
||||
MinIO supports automatically replicating existing objects in
|
||||
a bucket, however it does not enable existing object
|
||||
replication by default. Objects created before replication
|
||||
was configured or while replication is disabled are not
|
||||
synchronized to the target deployment unless replication of
|
||||
existing objects is enabled.
|
||||
a bucket; this setting is enabled by default. Please note
|
||||
that objects created before replication was configured or
|
||||
while replication is disabled are not synchronized to the
|
||||
target deployment in case this setting is not enabled.
|
||||
</Box>
|
||||
<Box sx={{ paddingTop: "10px" }}>
|
||||
MinIO supports replicating delete operations, where MinIO
|
||||
|
||||
Reference in New Issue
Block a user