-
Notifications
You must be signed in to change notification settings - Fork 184
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
Refactoring of 'replaceToken' code which changes PrometheusRules #2822
base: main
Are you sure you want to change the base?
Refactoring of 'replaceToken' code which changes PrometheusRules #2822
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aruniiird 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 |
417a269
to
2dae404
Compare
Added more details to 'replaceToken' struct which give more details about where the change is going to be reflected in the rule. Added usecases to tests. Signed-off-by: Arun Kumar Mohan <[email protected]>
2dae404
to
3623839
Compare
@aruniiird: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
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.
The initial idea of not specifying rule names for the osd/cluster utilization numbers was due to the fact that they were being changed across multiple rules, and we wanted the value to be replaced in all the rules. So if we want to cover it with particular rules we have to be careful to cover them in all the rules they appear.
createReplaceToken("", "", "0.75", fmt.Sprintf("%f", *specifiedNearFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterNearFull", | ||
"75%", fmt.Sprintf("%0.0f%%", *specifiedNearFullRatio*100), AnnotationRuleSection, DescriptionKey), | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterNearFull", |
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.
75 % & 0.75 needs to be replaced in CephClusterNearFull & CephOSDNearFull both
createReplaceToken("", "", "80%", fmt.Sprintf("%.2f%%", *specifiedBackfillFullRatio*100)), | ||
createReplaceToken("", "", "0.80", fmt.Sprintf("%f", *specifiedBackfillFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterCriticallyFull", | ||
"80%", fmt.Sprintf("%0.0f%%", *specifiedBackfillFullRatio*100), AnnotationRuleSection, DescriptionKey), |
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.
80%/0.80 needs to replaced in CephClusterCriticallyFull & CephOSDCriticallyFull.
createReplaceToken("", "", "85%", fmt.Sprintf("%.2f%%", *specifiedFullRatio*100)), | ||
createReplaceToken("", "", "0.85", fmt.Sprintf("%f", *specifiedFullRatio))) | ||
createReplaceToken("cluster-utilization-alert.rules", "CephClusterReadOnly", | ||
"85%", fmt.Sprintf("%0.0f%%", *specifiedFullRatio*100), AnnotationRuleSection, DescriptionKey), |
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.
85% needs to be replaced in CephClusterNearFull, CephClusterCriticallyFull, CephClusterReadOnly
Added more details to 'replaceToken' struct which give more details about where the change is going to be reflected in the rule. Added more usecases to tests.