ilm-add: update flags related to tiering (#4250)
This commit is contained in:
+23
-6
@@ -53,8 +53,15 @@ EXAMPLES:
|
||||
{{.Prompt}} {{.HelpName}} --expiry-days "200" myminio/mybucket
|
||||
|
||||
2. Add a lifecycle rule with a transition and a noncurrent version transition action for objects with prefix doc/ in mybucket.
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --transition-days "90" --storage-class "MINIOTIER-1" \
|
||||
--noncurrentversion-transition-days "45" --noncurrentversion-transition-storage-class "MINIOTIER2" \
|
||||
Tiers must exist in MinIO. Use existing tiers or add new tiers.
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-1 --endpoint https://warm-minio-1.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket1 --prefix prefix1
|
||||
|
||||
{{.Prompt}} mc tier add minio myminio MINIOTIER-2 --endpoint https://warm-minio-2.com \
|
||||
--access-key ACCESSKEY --secret-key SECRETKEY --bucket bucket2 --prefix prefix2
|
||||
|
||||
{{.Prompt}} {{.HelpName}} --prefix "doc/" --transition-days "90" --tier "MINIOTIER-1" \
|
||||
--noncurrentversion-transition-days "45" --noncurrentversion-tier "MINIOTIER-2" \
|
||||
myminio/mybucket/
|
||||
|
||||
3. Add a lifecycle rule with an expiration and a noncurrent version expiration action for all objects with prefix doc/ in mybucket.
|
||||
@@ -91,8 +98,13 @@ var ilmAddFlags = []cli.Flag{
|
||||
Usage: "the number of days to transition",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "storage-class",
|
||||
Usage: "storage class for current version to transition into. MinIO supports any warm tier configured via `mc-admin-tier-add`",
|
||||
Name: "storage-class",
|
||||
Usage: "storage class for current version to transition into. MinIO supports tiers configured via `mc-admin-tier-add`.",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tier",
|
||||
Usage: "remote tier where current versions transition to",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "expired-object-delete-marker",
|
||||
@@ -115,8 +127,13 @@ var ilmAddFlags = []cli.Flag{
|
||||
Usage: "the number of noncurrent versions to retain. If there are this many more recent noncurrent versions they will be transitioned",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "noncurrentversion-transition-storage-class",
|
||||
Usage: "storage class for noncurrent versions to transition into",
|
||||
Name: "noncurrentversion-transition-storage-class",
|
||||
Usage: "storage class for noncurrent versions to transition into",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "noncurrentversion-tier",
|
||||
Usage: "remote tier where noncurrent versions transition to",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
+15
-8
@@ -240,14 +240,14 @@ func GetLifecycleOptions(ctx *cli.Context) (LifecycleOptions, *probe.Error) {
|
||||
expiryDays *string
|
||||
transitionDate *string
|
||||
transitionDays *string
|
||||
sc *string
|
||||
tier *string
|
||||
|
||||
expiredObjectDeleteMarker *bool
|
||||
noncurrentVersionExpirationDays *int
|
||||
newerNoncurrentExpirationVersions *int
|
||||
noncurrentVersionTransitionDays *int
|
||||
newerNoncurrentTransitionVersions *int
|
||||
noncurrentSC *string
|
||||
noncurrentTier *string
|
||||
)
|
||||
|
||||
id = ctx.String("id")
|
||||
@@ -277,16 +277,23 @@ func GetLifecycleOptions(ctx *cli.Context) (LifecycleOptions, *probe.Error) {
|
||||
}
|
||||
}
|
||||
|
||||
// For backward-compatibility
|
||||
if ctx.IsSet("storage-class") {
|
||||
sc = strPtr(strings.ToUpper(ctx.String("storage-class")))
|
||||
tier = strPtr(strings.ToUpper(ctx.String("storage-class")))
|
||||
}
|
||||
if ctx.IsSet("noncurrentversion-transition-storage-class") {
|
||||
noncurrentSC = strPtr(strings.ToUpper(ctx.String("noncurrentversion-transition-storage-class")))
|
||||
noncurrentTier = strPtr(strings.ToUpper(ctx.String("noncurrentversion-transition-storage-class")))
|
||||
}
|
||||
if sc != nil && !ctx.IsSet("transition-days") && !ctx.IsSet("transition-date") {
|
||||
if ctx.IsSet("tier") {
|
||||
tier = strPtr(strings.ToUpper(ctx.String("tier")))
|
||||
}
|
||||
if ctx.IsSet("noncurrentversion-tier") {
|
||||
noncurrentTier = strPtr(strings.ToUpper(ctx.String("noncurrentversion-tier")))
|
||||
}
|
||||
if tier != nil && !ctx.IsSet("transition-days") && !ctx.IsSet("transition-date") {
|
||||
return LifecycleOptions{}, probe.NewError(errors.New("transition-date or transition-days must be set"))
|
||||
}
|
||||
if noncurrentSC != nil && !ctx.IsSet("noncurrentversion-transition-days") {
|
||||
if noncurrentTier != nil && !ctx.IsSet("noncurrentversion-transition-days") {
|
||||
return LifecycleOptions{}, probe.NewError(errors.New("noncurrentversion-transition-days must be set"))
|
||||
}
|
||||
// for MinIO transition storage-class is same as label defined on
|
||||
@@ -331,13 +338,13 @@ func GetLifecycleOptions(ctx *cli.Context) (LifecycleOptions, *probe.Error) {
|
||||
ExpiryDays: expiryDays,
|
||||
TransitionDate: transitionDate,
|
||||
TransitionDays: transitionDays,
|
||||
StorageClass: sc,
|
||||
StorageClass: tier,
|
||||
ExpiredObjectDeleteMarker: expiredObjectDeleteMarker,
|
||||
NoncurrentVersionExpirationDays: noncurrentVersionExpirationDays,
|
||||
NewerNoncurrentExpirationVersions: newerNoncurrentExpirationVersions,
|
||||
NoncurrentVersionTransitionDays: noncurrentVersionTransitionDays,
|
||||
NewerNoncurrentTransitionVersions: newerNoncurrentTransitionVersions,
|
||||
NoncurrentVersionTransitionStorageClass: noncurrentSC,
|
||||
NoncurrentVersionTransitionStorageClass: noncurrentTier,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user