Skip to content

UPSTREAM: 1873: evictions: fix assumePod silently dropping success metric on informer race#637

Merged
ingvagabund merged 1 commit into
openshift:release-4.22from
ingvagabund:release-4.22
May 18, 2026
Merged

UPSTREAM: 1873: evictions: fix assumePod silently dropping success metric on informer race#637
ingvagabund merged 1 commit into
openshift:release-4.22from
ingvagabund:release-4.22

Conversation

@ingvagabund

@ingvagabund ingvagabund commented May 17, 2026

Copy link
Copy Markdown
Member

When KubeVirt sets EvictionInProgressAnnotationKey before returning TooManyRequests, the informer's UpdateFunc can call addPod (evictionAssumed=false) before evictPod's assumePod call arrives. assumePod found the entry already present and returned early, leaving evictionAssumed=false. DeleteFunc then skipped the "success" metric.

Fix: if the existing entry has evictionAssumed=false (added by addPod), upgrade it in place without double-counting the pod in the counters.

Adds TestEvictionInBackgroundMetrics_InformerRace to reproduce the race deterministically.

Pulling kubernetes-sigs#1873.

Description

Checklist

Please ensure your pull request meets the following criteria before submitting
for review, these items will be used by reviewers to assess the quality and
completeness of your changes:

  • Code Readability: Is the code easy to understand, well-structured, and consistent with project conventions?
  • Naming Conventions: Are variable, function, and structs descriptive and consistent?
  • Code Duplication: Is there any repeated code that should be refactored?
  • Function/Method Size: Are functions/methods short and focused on a single task?
  • Comments & Documentation: Are comments clear, useful, and not excessive? Were comments updated where necessary?
  • Error Handling: Are errors handled appropriately ?
  • Testing: Are there sufficient unit/integration tests?
  • Performance: Are there any obvious performance issues or unnecessary computations?
  • Dependencies: Are new dependencies justified ?
  • Logging & Monitoring: Is logging used appropriately (not too verbose, not too silent)?
  • Backward Compatibility: Does this change break any existing functionality or APIs?
  • Resource Management: Are resources (files, connections, memory) managed and released properly?
  • PR Description: Is the PR description clear, providing enough context and explaining the motivation for the change?
  • Documentation & Changelog: Are README and docs updated if necessary?

…tric on informer race

When KubeVirt sets EvictionInProgressAnnotationKey before returning
TooManyRequests, the informer's UpdateFunc can call addPod
(evictionAssumed=false) before evictPod's assumePod call arrives.
assumePod found the entry already present and returned early, leaving
evictionAssumed=false. DeleteFunc then skipped the "success" metric.

Fix: if the existing entry has evictionAssumed=false (added by addPod),
upgrade it in place without double-counting the pod in the counters.

Adds TestEvictionInBackgroundMetrics_InformerRace to reproduce the race
deterministically.

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@openshift-ci openshift-ci Bot requested a review from ricardomaraschini May 17, 2026 13:29
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2026
@openshift-ci

openshift-ci Bot commented May 17, 2026

Copy link
Copy Markdown

@ingvagabund: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security 3f3be90 link false /test security

Full PR test history. Your PR dashboard.

Details

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.

@tiraboschi

Copy link
Copy Markdown

/lgtm

@openshift-ci

openshift-ci Bot commented May 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ingvagabund, tiraboschi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 18, 2026
@ingvagabund ingvagabund merged commit f22c8d6 into openshift:release-4.22 May 18, 2026
4 of 6 checks passed
@ingvagabund ingvagabund deleted the release-4.22 branch May 18, 2026 08:29
@tiraboschi

Copy link
Copy Markdown

/cherry-pick main

@openshift-cherrypick-robot

Copy link
Copy Markdown

@tiraboschi: new pull request created: #789

Details

In response to this:

/cherry-pick main

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants