Skip to content

Bug fix: use guest node name when draining node on VM eviction - #374

Merged
k8s-ci-robot merged 3 commits into
kubernetes-sigs:mainfrom
nunnatsa:fix-drain-guest-node-name
Feb 25, 2026
Merged

k8s-ci-robot merged 3 commits into
kubernetes-sigs:mainfrom
nunnatsa:fix-drain-guest-node-name

Conversation

@nunnatsa

@nunnatsa nunnatsa commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

drainNode() was using vmiInstance.Status.EvacuationNodeName to look up the node in the guest cluster, but that field contains the host/infra node name.
This caused the drain to silently fail with a NotFound error, meaning workloads were abruptly killed instead of being gracefully evicted.

Use KubevirtMachine.Name instead, which is the guest node name, consistent with the rest of the codebase (e.g. updateNodeProviderID, GenerateProviderID).

This PR fixes the issue described in https://issues.redhat.com/browse/OCPBUGS-66890

Release notes:

Bug fix: use guest node name when draining node on VM eviction 

nunnatsa and others added 2 commits February 25, 2026 10:03
drainNode() was using vmiInstance.Status.EvacuationNodeName to look up the
node in the guest cluster, but that field contains the host/infra node name.
This caused the drain to silently fail with a NotFound error, meaning
workloads were abruptly killed instead of being gracefully evicted.

Use KubevirtMachine.Name instead, which is the guest node name, consistent
with the rest of the codebase (e.g. updateNodeProviderID, GenerateProviderID).

Update unit tests to use distinct values for the host node name and guest
node name, so the bug cannot be masked again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The eviction e2e test only validated that the VMI was deleted and recreated,
but did not check that the guest node was actually drained. Add an assertion
that the guest node is marked unschedulable (cordoned) before the VMI
finalizer is removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 25, 2026
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 25, 2026
@nunnatsa

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Feb 25, 2026
…ction

Signed-off-by: Nahshon Unna Tsameret <nunnatsa@redhat.com>
@nunnatsa
nunnatsa force-pushed the fix-drain-guest-node-name branch from a110d30 to 0f33c9c Compare February 25, 2026 12:02
@qinqon

qinqon commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nunnatsa, qinqon

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

@k8s-ci-robot
k8s-ci-robot merged commit bec80b4 into kubernetes-sigs:main Feb 25, 2026
16 checks passed
@nunnatsa
nunnatsa deleted the fix-drain-guest-node-name branch February 25, 2026 13:22
@nunnatsa

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-0.11 release-0.10

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants