-
Notifications
You must be signed in to change notification settings - Fork 328
cluster: support retention by size for prometheus #2612
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
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| AdditionalArgs: spec.AdditionalArgs, | ||
| } | ||
| // Set retention policy | ||
| if spec.RetentionTime == "" { |
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 is to handle the deprecated Retention, right? Maybe add a comment about this. Could also be a good place to emit a warning about the use of deprecated things.
| func getRetention(retention string) string { | ||
| func getRetentionSize(retention string) string { | ||
| retention = strings.ToUpper(strings.TrimSpace(retention)) | ||
| valid, _ := regexp.MatchString("^[1-9]\\d*(B|KB|MB|GB|TB|PB|EB)$", retention) |
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 about KiB etc?
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.
Didn't see that in Prometheus doc though...
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.
Then this should be fine.
| retention = strings.ToUpper(strings.TrimSpace(retention)) | ||
| valid, _ := regexp.MatchString("^[1-9]\\d*(B|KB|MB|GB|TB|PB|EB)$", retention) | ||
| if retention == "" || !valid { | ||
| return "" |
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.
Can we log a warning or something similar if !valid ?
|
@dveeden: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What problem does this PR solve?
Add support of retention by size for Prometheus. Default value is empty to keep former behavior unchanged. The
storage.tsdb.retention.sizeandstorage.tsdb.retention.timecan be set together.See Prometheus doc for details.
Also close #2058
Check List
Tests
Code changes
Side effects
Related changes
Release notes: