Skip to content

Conversation

@lexfrei
Copy link
Contributor

@lexfrei lexfrei commented Jan 5, 2026

What this PR does

Reverts PR #1770 which incorrectly changed status/phase checks from lowercase to uppercase.

The actual KubeVirt metrics use lowercase:

  • kubevirt_vm_info uses status="running" (not "Running")
  • kubevirt_vmi_info uses phase="running" (not "Running")

Verification

Queried virt-controller metrics directly in cluster:

kubevirt_vm_info{...,status="running",status_group="running",...} 1
kubevirt_vmi_info{...,phase="running",...} 1

Note: kubectl get vm shows STATUS: Running with capital R, but this is display formatting — the actual metric labels use lowercase.

Release note

[kubevirt-operator] Fix VM alert rules to use correct lowercase status values

Summary by CodeRabbit

Bug Fixes

  • Fixed alert condition logic for virtual machine monitoring to accurately detect non-running states, improving alert reliability and ensuring proper detection across virtual machines and virtual machine instances.

✏️ Tip: You can customize this high-level summary in your review settings.

Revert PR #1770 which incorrectly changed status check from lowercase
to uppercase. The actual metrics use lowercase:
- kubevirt_vm_info uses status="running" (not "Running")
- kubevirt_vmi_info uses phase="running" (not "Running")

Verified by querying virt-controller metrics in instories cluster.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

A configuration file for KubeVirt operator alert rules was modified to change PromQL filter values from uppercase to lowercase. The changes affect status and phase condition comparisons in VM and VMI alert rules.

Changes

Cohort / File(s) Summary
KubeVirt Alert Configuration
packages/system/kubevirt-operator/alerts/PrometheusRule.yaml
Updated PromQL filter syntax: changed status!="Running" to status!="running" and phase!="Running" to phase!="running" in alert condition rules for both VM and VMI resources

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A filter's case made quite a fuss,
From "Running" to "running" for us,
The alerts now align,
In lowercase design,
No more uppercase status rush! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: reverting incorrect case changes in VM alerts from uppercase back to lowercase, which aligns with the core objective of fixing alert conditions to match actual KubeVirt metric values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lexfrei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where the case of status and phase checks in VM alerts was incorrectly changed to uppercase. By reverting these changes, the alert rules now correctly use lowercase values, aligning with the actual KubeVirt metrics. This ensures that the alerts function as intended and accurately reflect the status of virtual machines.

Highlights

  • Reverts Case Change in VM Alerts: This PR reverts the incorrect case change introduced in PR [kubevirt-operator] Fix typo in VMNotRunningFor10Minutes alert #1770, ensuring that status/phase checks in VM alerts use lowercase as expected by KubeVirt metrics.
  • Lowercase Status Values: The KubeVirt metrics use lowercase values for status and phase (e.g., status="running", phase="running"), which this PR corrects in the alert rules.
  • Verification: The changes have been verified by querying virt-controller metrics directly in the instories cluster, confirming the use of lowercase values.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 5, 2026
@lexfrei lexfrei marked this pull request as ready for review January 5, 2026 14:40
@lexfrei lexfrei requested review from kvaps and nbykov0 as code owners January 5, 2026 14:40
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 5, 2026
@lexfrei lexfrei enabled auto-merge January 5, 2026 14:40
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR correctly fixes the casing for status/phase values in the KubeVirt Prometheus alert rules. This is an important correctness fix. I've also added a couple of comments with suggestions to improve the alert logic to prevent false positives and make the alerts more precise. These are significant issues that could cause alert fatigue, so I recommend addressing them, either in this PR or a follow-up.

@dosubot dosubot bot added the bug Something isn't working label Jan 5, 2026
@lexfrei lexfrei disabled auto-merge January 5, 2026 14:41
@lllamnyp lllamnyp added backport Should change be backported on previus release backport-previous labels Jan 5, 2026
@lexfrei lexfrei enabled auto-merge January 5, 2026 14:41
@lexfrei lexfrei merged commit 695fc05 into main Jan 5, 2026
31 checks passed
@lexfrei lexfrei deleted the revert/kubevirt-alert-case-fix branch January 5, 2026 15:19
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

Successfully created backport PR for release-0.38:

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

Successfully created backport PR for release-0.39:

kvaps added a commit that referenced this pull request Jan 5, 2026
…nge in VM alerts (#1806)

# Description
Backport of #1804 to `release-0.39`.
kvaps added a commit that referenced this pull request Jan 5, 2026
…nge in VM alerts (#1805)

# Description
Backport of #1804 to `release-0.38`.
kvaps pushed a commit that referenced this pull request Jan 8, 2026
## What this PR does

Reverts PR #1770 which incorrectly changed status/phase checks from
lowercase to uppercase.

The actual KubeVirt metrics use **lowercase**:
- `kubevirt_vm_info` uses `status="running"` (not `"Running"`)
- `kubevirt_vmi_info` uses `phase="running"` (not `"Running"`)

### Verification

Queried virt-controller metrics directly in the instories cluster:

```
kubevirt_vm_info{...,status="running",status_group="running",...} 1
kubevirt_vmi_info{...,phase="running",...} 1
```

Note: `kubectl get vm` shows `STATUS: Running` with capital R, but this
is display formatting — the actual metric labels use lowercase.

### Release note

```release-note
[kubevirt-operator] Fix VM alert rules to use correct lowercase status values
```
kvaps pushed a commit that referenced this pull request Jan 8, 2026
## What this PR does

Reverts PR #1770 which incorrectly changed status/phase checks from
lowercase to uppercase.

The actual KubeVirt metrics use **lowercase**:
- `kubevirt_vm_info` uses `status="running"` (not `"Running"`)
- `kubevirt_vmi_info` uses `phase="running"` (not `"Running"`)

### Verification

Queried virt-controller metrics directly in the instories cluster:

```
kubevirt_vm_info{...,status="running",status_group="running",...} 1
kubevirt_vmi_info{...,phase="running",...} 1
```

Note: `kubectl get vm` shows `STATUS: Running` with capital R, but this
is display formatting — the actual metric labels use lowercase.

### Release note

```release-note
[kubevirt-operator] Fix VM alert rules to use correct lowercase status values
```
kvaps pushed a commit that referenced this pull request Jan 9, 2026
## What this PR does

Reverts PR #1770 which incorrectly changed status/phase checks from
lowercase to uppercase.

The actual KubeVirt metrics use **lowercase**:
- `kubevirt_vm_info` uses `status="running"` (not `"Running"`)
- `kubevirt_vmi_info` uses `phase="running"` (not `"Running"`)

### Verification

Queried virt-controller metrics directly in the instories cluster:

```
kubevirt_vm_info{...,status="running",status_group="running",...} 1
kubevirt_vmi_info{...,phase="running",...} 1
```

Note: `kubectl get vm` shows `STATUS: Running` with capital R, but this
is display formatting — the actual metric labels use lowercase.

### Release note

```release-note
[kubevirt-operator] Fix VM alert rules to use correct lowercase status values
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Should change be backported on previus release backport-previous bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants