Skip to content

Commit

Permalink
cleanup: Rename deprecated API alert to singular
Browse files Browse the repository at this point in the history
Renaming KubeVirtDeprecatedAPIsRequested to
KubeVirtDeprecatedAPIRequested avoids confusion about use of singular or
plural.

Signed-off-by: Felix Matouschek <[email protected]>
  • Loading branch information
0xFelix committed Jun 9, 2023
1 parent dbb701a commit e187a27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions hack/prom-rule-ci/prom-rules-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -859,15 +859,15 @@ tests:

alert_rule_test:
- eval_time: 1m
alertname: KubeVirtDeprecatedAPIsRequested
alertname: KubeVirtDeprecatedAPIRequested
exp_alerts: []
- eval_time: 2m
alertname: KubeVirtDeprecatedAPIsRequested
alertname: KubeVirtDeprecatedAPIRequested
exp_alerts:
- exp_annotations:
description: "Detected requests to the deprecated virtualmachines.kubevirt.io/v1alpha3 API."
summary: "Detected 1 requests in the last 10 minutes."
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubeVirtDeprecatedAPIsRequested"
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubeVirtDeprecatedAPIRequested"
exp_labels:
severity: "info"
operator_health_impact: "none"
Expand All @@ -877,12 +877,12 @@ tests:
group: "kubevirt.io"
version: "v1alpha3"
- eval_time: 3m
alertname: KubeVirtDeprecatedAPIsRequested
alertname: KubeVirtDeprecatedAPIRequested
exp_alerts:
- exp_annotations:
description: "Detected requests to the deprecated virtualmachines.kubevirt.io/v1alpha3 API."
summary: "Detected 2 requests in the last 10 minutes."
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubeVirtDeprecatedAPIsRequested"
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubeVirtDeprecatedAPIRequested"
exp_labels:
severity: "info"
operator_health_impact: "none"
Expand All @@ -892,5 +892,5 @@ tests:
group: "kubevirt.io"
version: "v1alpha3"
- eval_time: 13m
alertname: KubeVirtDeprecatedAPIsRequested
alertname: KubeVirtDeprecatedAPIRequested
exp_alerts: []
4 changes: 2 additions & 2 deletions pkg/virt-operator/resource/generate/components/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,12 @@ func NewPrometheusRuleSpec(ns string, workloadUpdatesEnabled bool) *v1.Prometheu
},
},
{
Alert: "KubeVirtDeprecatedAPIsRequested",
Alert: "KubeVirtDeprecatedAPIRequested",
Expr: intstr.FromString("sum by (resource,group,version) ((round(increase(kubevirt_api_request_deprecated_total{verb!~\"LIST|WATCH\"}[10m])) > 0 and kubevirt_api_request_deprecated_total{verb!~\"LIST|WATCH\"} offset 10m) or (kubevirt_api_request_deprecated_total{verb!~\"LIST|WATCH\"} != 0 unless kubevirt_api_request_deprecated_total{verb!~\"LIST|WATCH\"} offset 10m))"),
Annotations: map[string]string{
"description": "Detected requests to the deprecated {{ $labels.resource }}.{{ $labels.group }}/{{ $labels.version }} API.",
"summary": "Detected {{ $value }} requests in the last 10 minutes.",
"runbook_url": fmt.Sprintf(runbookURLTemplate, "KubeVirtDeprecatedAPIsRequested"),
"runbook_url": fmt.Sprintf(runbookURLTemplate, "KubeVirtDeprecatedAPIRequested"),
},
Labels: map[string]string{
severityAlertLabelKey: "info",
Expand Down
6 changes: 3 additions & 3 deletions tests/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ var _ = Describe("[Serial][sig-monitoring]Monitoring", Serial, decorators.SigMon
})

Context("Deprecation Alerts", decorators.SigComputeMigrations, func() {
It("KubeVirtDeprecatedAPIsRequested should be triggered when a deprecated API is requested", func() {
It("KubeVirtDeprecatedAPIRequested should be triggered when a deprecated API is requested", func() {
By("Creating a VMI with deprecated API version")
vmi := libvmi.NewCirros()
vmi.APIVersion = "v1alpha3"
Expand All @@ -183,10 +183,10 @@ var _ = Describe("[Serial][sig-monitoring]Monitoring", Serial, decorators.SigMon
Expect(err).ToNot(HaveOccurred())

By("Verifying the alert exists")
verifyAlertExist(virtClient, "KubeVirtDeprecatedAPIsRequested")
verifyAlertExist(virtClient, "KubeVirtDeprecatedAPIRequested")

By("Verifying the alert disappears")
waitUntilAlertDoesNotExistWithCustomTime(virtClient, 15*time.Minute, "KubeVirtDeprecatedAPIsRequested")
waitUntilAlertDoesNotExistWithCustomTime(virtClient, 15*time.Minute, "KubeVirtDeprecatedAPIRequested")
})
})

Expand Down

0 comments on commit e187a27

Please sign in to comment.