New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow usage check to be configurable #6006
Conversation
bd03cfd
to
6769041
Compare
Codecov Report
@@ Coverage Diff @@
## master #6006 +/- ##
==========================================
- Coverage 59.65% 58.35% -1.31%
==========================================
Files 217 214 -3
Lines 30939 24958 -5981
==========================================
- Hits 18458 14565 -3893
+ Misses 10933 8809 -2124
- Partials 1548 1584 +36
Continue to review full report at Codecov.
|
6769041
to
07b69fb
Compare
cmd/ui-errors.go
Outdated
"Invalid usage check interval value", | ||
"Please check the passed value", | ||
`MINIO_USAGE_CHECK_INTERVAL: Valid usage check interval duration string is a signed sequence of decimal numbers, | ||
each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would "-1.5h" mean in the context of usage check interval?
cmd/common-main.go
Outdated
@@ -153,6 +153,19 @@ func handleCommonEnvVars() { | |||
globalCacheExpiry = expiry | |||
} | |||
|
|||
if intervalStr := os.Getenv("MINIO_USAGE_CHECK_INTERVAL"); intervalStr != "" { | |||
interval, err := time.ParseDuration(intervalStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could move parsing of a string to time.Duration
and validating it into a separate function.
07b69fb
to
a7f6024
Compare
a7f6024
to
09a1d03
Compare
cmd/config-versions.go
Outdated
@@ -602,3 +602,30 @@ type serverConfigV23 struct { | |||
// Notification queue configuration. | |||
Notify notifier `json:"notify"` | |||
} | |||
|
|||
// serverConfigV24 is just like version '23' with addition of usage interval | |||
// field.n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field.n -> field.
cmd/ui-errors.go
Outdated
"Please check the passed value", | ||
`MINIO_USAGE_CHECK_INTERVAL: Valid usage check interval duration string is a signed sequence of decimal numbers, | ||
each with optional fraction and a unit suffix, such as "2h45m". | ||
Valid time units are "ns", "us", "ms", "s", "m", "h".`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshavardhana, the indentation is off on the last 2 lines of the help message.
ERROR Unable to parse MINIO_USAGE_CHECK_INTERVAL value (`abc`): Invalid usage check interval
value.
> Please check the passed value.
HELP:
MINIO_USAGE_CHECK_INTERVAL: Valid usage check interval duration string is a signed sequence of
decimal numbers,
each with optional fraction and a unit suffix, such as "2h45m".
Valid time units are "ns", "us", "ms", "s", "m", "h".
} | ||
if d < globalMinimumUsageCheckInterval { | ||
return d, fmt.Errorf("interval %s is not allowed, minimum required value is %s", | ||
d, globalMinimumUsageCheckInterval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check doesn't seem to be executed.pls check
➜ minio git:(09a1d039) export MINIO_USAGE_CHECK_INTERVAL=1h45m
➜ minio git:(09a1d039) ./minio server ~/export
ERROR Unable to parse MINIO_USAGE_CHECK_INTERVAL value (`1h45m`): Invalid usage check interva
l value.
> Please check the passed value.
HELP:
MINIO_USAGE_CHECK_INTERVAL: Valid usage check interval duration string is a signed sequence of
decimal numbers,
each with optional fraction and a unit suffix, such as "2h45m".
Valid time units are "ns", "us", "ms", "s", "m", "h".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check is executed the message is only printed when json flag is enabled.
09a1d03
to
ca1bae5
Compare
ca1bae5
to
a857141
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Mint Automation
6006-a857141/mint-fs.sh.log:
6006-a857141/mint-gateway-s3.sh.log:
|
Description
Allow usage check to be configurable
Motivation and Context
Usage check configurable using
config.json
How Has This Been Tested?
Manually
Types of changes
Checklist:
mint
PR # here: )