Bug 2210554

Summary: KubeVirtComponentExceedsRequestedCPU alert not firing
Product: Container Native Virtualization (CNV) Reporter: Ohad <orevah>
Component: MetricsAssignee: João Vilaça <jvilaca>
Status: CLOSED ERRATA QA Contact: Ahmad <ahafe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.13.0CC: jvilaca, kmajcher, stirabos
Target Milestone: ---   
Target Release: 4.14.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hco-bundle-registry-container-v4.14.0.rhel9-826 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:05:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ohad 2023-05-28 13:49:57 UTC
Description of problem:
This alert should not fired, the metric for that doesn't catch when the conditions are met.

How reproducible:
Reduce the cpu request.

Steps to Reproduce:
1.scale down virt-operator
oc -n openshift-cnv scale deployment virt-operator --repilicas=0
2.Modify the cpu requested from one of the virt-components:
oc -n openshift-cnv patch deployment virt-controller -p '{"spec": {"template": {"spec": {"containers": [{"name": "virt-controller", "resources": {"requests": {"cpu": "2Mi"}}}]}}}}'
3.Run the metric: 
((kube_pod_container_resource_requests{container=~"virt-controller|virt-api|virt-handler|virt-operator",namespace="openshift-cnv",resource="cpu"}) - on (pod) group_left (node) node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate{namespace="openshift-cnv"}) < 0

Actual results:
No datapoints found

Expected results:
The metric should fire the alert.

Additional info:
scale up again the virt-operator for reconciliation.
There is a similar alert just for the memory : KubeVirtComponentExceedsRequestedMemory, this alert is fired and works when reducing the memory in the same way reducing the cpu for the alert above.

Comment 1 Ahmad 2023-06-13 13:28:58 UTC
QA: Fixed verified v4.14
Fixed In Version: hco-bundle-registry-container-v4.14.0.rhel9-826



[cloud-user@ocp-psi-executor ~]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/alerts | jq . | grep "Exceed"
[cloud-user@ocp-psi-executor ~]$ 
[cloud-user@ocp-psi-executor ~]$ oc -n openshift-cnv scale deployment virt-operator --replicas=0
deployment.apps/virt-operator scaled
[cloud-user@ocp-psi-executor ~]$ oc -n openshift-cnv patch deployment virt-controller -p '{"spec": {"template": {"spec": {"containers": [{"name": "virt-controller", "resources": {"requests": {"memory": "0Mi"}}}]}}}}'
deployment.apps/virt-controller patched (no change)
[cloud-user@ocp-psi-executor ~]$ oc exec -n openshift-monitoring prometheus-k8s-0 -c prometheus -- curl -s http://127.0.0.1:9090/api/v1/alerts | jq . | grep "Exceed"
          "alertname": "KubeVirtComponentExceedsRequestedMemory",
          "runbook_url": "https://docs.openshift.com/container-platform/4.14/virt/support/virt-runbooks.html#virt-runbook-KubeVirtComponentExceedsRequestedMemory",
          "alertname": "KubeVirtComponentExceedsRequestedMemory",
          "runbook_url": "https://docs.openshift.com/container-platform/4.14/virt/support/virt-runbooks.html#virt-runbook-KubeVirtComponentExceedsRequestedMemory",

Comment 3 errata-xmlrpc 2023-11-08 14:05:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.14.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6817