Skip to content

Commit

Permalink
Fix incorrect KubevirtVmHighMemoryUsage description
Browse files Browse the repository at this point in the history
Signed-off-by: João Vilaça <jvilaca@redhat.com>
  • Loading branch information
machadovilaca committed Jun 9, 2023
1 parent 251b1a4 commit fe854c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions hack/prom-rule-ci/prom-rules-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ tests:
alertname: KubevirtVmHighMemoryUsage
exp_alerts:
- exp_annotations:
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 20 MB and it is close to requested memory"
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 50Mi and it is close to requested memory"
summary: "VM is at risk of being evicted and in serious cases of memory exhaustion being terminated by the runtime."
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubevirtVmHighMemoryUsage"
exp_labels:
Expand All @@ -601,7 +601,7 @@ tests:
alertname: KubevirtVmHighMemoryUsage
exp_alerts:
- exp_annotations:
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 20 MB and it is close to requested memory"
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 50Mi and it is close to requested memory"
summary: "VM is at risk of being evicted and in serious cases of memory exhaustion being terminated by the runtime."
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubevirtVmHighMemoryUsage"
exp_labels:
Expand All @@ -628,7 +628,7 @@ tests:
alertname: KubevirtVmHighMemoryUsage
exp_alerts:
- exp_annotations:
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 20 MB and it is close to requested memory"
description: "Container compute in pod virt-launcher-testvm-123 in namespace ns-test free memory is less than 50Mi and it is close to requested memory"
summary: "VM is at risk of being evicted and in serious cases of memory exhaustion being terminated by the runtime."
runbook_url: "https://kubevirt.io/monitoring/runbooks/KubevirtVmHighMemoryUsage"
exp_labels:
Expand Down
5 changes: 4 additions & 1 deletion pkg/virt-operator/resource/generate/components/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package components
import (
"errors"
"fmt"
"k8s.io/apimachinery/pkg/api/resource"
"os"
"strings"

Expand Down Expand Up @@ -97,6 +98,8 @@ func NewPrometheusRuleSpec(ns string, workloadUpdatesEnabled bool) *v1.Prometheu
return fmt.Sprintf(errorRatioQuery, ns, podName, errorCodeRegex, durationInMinutes, ns, podName, durationInMinutes)
}

fiftyMB := resource.MustParse("50Mi")

runbookURLTemplate := getRunbookURLTemplate()

var kubevirtRules []v1.Rule
Expand Down Expand Up @@ -383,7 +386,7 @@ func NewPrometheusRuleSpec(ns string, workloadUpdatesEnabled bool) *v1.Prometheu
Expr: intstr.FromString("kubevirt_vm_container_free_memory_bytes_based_on_working_set_bytes < 52428800 or kubevirt_vm_container_free_memory_bytes_based_on_rss < 52428800"),
For: "1m",
Annotations: map[string]string{
"description": "Container {{ $labels.container }} in pod {{ $labels.pod }} in namespace {{ $labels.namespace }} free memory is less than 20 MB and it is close to requested memory",
"description": fmt.Sprintf("Container {{ $labels.container }} in pod {{ $labels.pod }} in namespace {{ $labels.namespace }} free memory is less than %s and it is close to requested memory", fiftyMB.String()),
"summary": "VM is at risk of being evicted and in serious cases of memory exhaustion being terminated by the runtime.",
"runbook_url": fmt.Sprintf(runbookURLTemplate, "KubevirtVmHighMemoryUsage"),
},
Expand Down

0 comments on commit fe854c3

Please sign in to comment.