minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

Show ILM Expiry Replication status only if enabled #4900

Closed shtripat closed 6 months ago

shtripat commented 6 months ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the Apache 2 license. By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

In case Replication of ILM Expiry rules disabled, mention the same in mc amdin replicate status ALIAS output.

Motivation and Context

How to test this PR?

Follow below detailed steps for verifying the different scenarios

Step-1: Create three MinIO sites sat m1, m2 and m3

Step-2: Setup site replication between the first two sites now mc admin replicate add m1 m2

Step-3: Create a bucket for first and third sites (test-bucket) mc mb m1/test-bucket mc mb m3/test-bucket

Step-4: Setup warm tier to m3 for site m1

$ ./mc mb m3/test-bucket
$ ./mc ilm tier add minio m1 WARM-TIER --endpoint http://localhost:9020 --access-key minioadmin --secret-key minioadmin --bucket test-bucket

Step-5: Add ILM rule to the first site's bucket and verify their availability on other sites

$ mc ilm add m1/test-bucket --transition-days 0 --transition-tier WARM-TIER --transition-days 0 --noncurrent-expire-days 2 --expire-days 3 --prefix "shu" --tags "tag1=val1&tag2=val2&tag3=val3"

$ mc ilm rule list m1/test-bucket 
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Expiration for latest version (Expiration)                                                                     │
├──────────────────────┬─────────┬────────┬───────────────────────────────┬────────────────┬─────────────────────┤
│ ID                   │ STATUS  │ PREFIX │ TAGS                          │ DAYS TO EXPIRE │ EXPIRE DELETEMARKER │
├──────────────────────┼─────────┼────────┼───────────────────────────────┼────────────────┼─────────────────────┤
│ cocf135b4dtrk4na0c30 │ Enabled │ shu    │ tag1=val1&tag2=val2&tag3=val3 │              3 │ false               │
└──────────────────────┴─────────┴────────┴───────────────────────────────┴────────────────┴─────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Expiration for older versions (NoncurrentVersionExpiration)                                              │
├──────────────────────┬─────────┬────────┬───────────────────────────────┬────────────────┬───────────────┤
│ ID                   │ STATUS  │ PREFIX │ TAGS                          │ DAYS TO EXPIRE │ KEEP VERSIONS │
├──────────────────────┼─────────┼────────┼───────────────────────────────┼────────────────┼───────────────┤
│ cocf135b4dtrk4na0c30 │ Enabled │ shu    │ tag1=val1&tag2=val2&tag3=val3 │              2 │             0 │
└──────────────────────┴─────────┴────────┴───────────────────────────────┴────────────────┴───────────────┘
┌────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Transition for latest version (Transition)                                                         │
├──────────────────────┬─────────┬────────┬───────────────────────────────┬──────────────┬───────────┤
│ ID                   │ STATUS  │ PREFIX │ TAGS                          │ DAYS TO TIER │ TIER      │
├──────────────────────┼─────────┼────────┼───────────────────────────────┼──────────────┼───────────┤
│ cocf135b4dtrk4na0c30 │ Enabled │ shu    │ tag1=val1&tag2=val2&tag3=val3 │            0 │ WARM-TIER │
└──────────────────────┴─────────┴────────┴───────────────────────────────┴──────────────┴───────────┘
$ mc  ./mc ilm rule list m2/test-bucket 
mc: <ERROR> Unable to get lifecycle. The lifecycle configuration does not exist.

$ mc  ./mc ilm rule list m3/test-bucket 
mc: <ERROR> Unable to get lifecycle. The lifecycle configuration does not exist.

Step-6: Check replicate status for first site

$ mc admin replicate status m1 
Bucket replication status:
●  1/1 Buckets in sync

Policy replication status:
●  5/5 Policies in sync

User replication status:
No Users present

Group replication status:
No Groups present

ILM Expiry Rules replication status:
Replication of ILM Expiry is not enabled <<<====== Says disabled

Object replication status:
Replication status since 1 minute 
Summary:
Replicated:    0 objects (0 B)
Queued:        ● 0 objects, (0 B) (avg: 0 objects, 0 B; max: 0 objects, 0 B)
Received:      0 objects (0 B)

Step-7: Enable and disable replication of ILM expiry rules and check replicate status

$ mc admin replicate update m1 --enable-ilm-expiry-replication
Cluster replication configuration updated successfully with:
- replicate-ilm-expiry: true

$ mc admin replicate status m1 
Bucket replication status:
●  1/1 Buckets in sync

Policy replication status:
●  5/5 Policies in sync

User replication status:
No Users present

Group replication status:
No Groups present

ILM Expiry Rules replication status:
●  1/1 ILM Expiry Rules in sync  <<===== shows the actual status

Object replication status:
Replication status since 2 minutes 
Summary:
Replicated:    0 objects (0 B)
Queued:        ● 0 objects, (0 B) (avg: 0 objects, 0 B; max: 0 objects, 0 B)
Received:      0 objects (0 B)

$ mc  ./mc admin replicate status m2
Bucket replication status:
●  1/1 Buckets in sync

Policy replication status:
●  5/5 Policies in sync

User replication status:
No Users present

Group replication status:
No Groups present

ILM Expiry Rules replication status:
●  1/1 ILM Expiry Rules in sync <<<===== Shows the actual status

Object replication status:
Replication status since 2 minutes 
Summary:
Replicated:    0 objects (0 B)
Queued:        ● 0 objects, (0 B) (avg: 0 objects, 0 B; max: 0 objects, 0 B)
Received:      0 objects (0 B)

$ mc admin replicate update m1 --disable-ilm-expiry-replication 
Cluster replication configuration updated successfully with:
- replicate-ilm-expiry: false

$ mc admin replicate status m1
Bucket replication status:
●  1/1 Buckets in sync

Policy replication status:
●  5/5 Policies in sync

User replication status:
No Users present

Group replication status:
No Groups present

ILM Expiry Rules replication status:
Replication of ILM Expiry is not enabled <<<==== After disables says accordingly that ILM expiry replication is disabled

Object replication status:
Replication status since 2 minutes 
Summary:
Replicated:    0 objects (0 B)
Queued:        ● 0 objects, (0 B) (avg: 0 objects, 0 B; max: 0 objects, 0 B)
Received:      0 objects (0 B)

Types of changes

Checklist: