-
Notifications
You must be signed in to change notification settings - Fork 252
OCPBUGS-101813: only block vSphere machine deletion for VMDK-backed v… #1528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jcpowermac
wants to merge
2
commits into
openshift:main
Choose a base branch
from
jcpowermac:ocpbugs-101813-volume-type-filtering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+903
−6
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
|
|
||
|
|
||
| # OCPBUGS-101813 — vSphere machine controller nodeHasVolumesAttached() blocks deletion indefinitely with no timeout for non-VMDK volumes | ||
| | Field | Value | | ||
| |---|---| | ||
| | **Project** | OpenShift Bugs (OCPBUGS) | | ||
| | **Issue Type** | Bug | | ||
| | **Status** | New | | ||
| | **Priority** | Normal | | ||
| | **Reporter** | ship-help-jira | | ||
| | **Assignee** | — | | ||
| | **Components** | Cloud Compute / Machine API Providers | | ||
| | **Affects Versions** | 4.17 | | ||
| | **Security Level** | Red Hat Employee | | ||
| | **Created** | 2026-08-03 | | ||
|
|
||
| --- | ||
| ## Summary | ||
| The vSphere machine actuator's `delete()` method in `pkg/controller/vsphere/reconciler.go` calls `nodeHasVolumesAttached()` which checks `node.Status.VolumesAttached`. If any volumes are reported as attached, the reconciler requeues indefinitely with no timeout or escape hatch. This creates an unrecoverable state when non-VMDK volumes (e.g. NFS via NetApp/Trident CSI) are attached, because the VMDK data loss risk that motivates the check does not apply to these volume types, yet the check is volume-type-agnostic. | ||
| ## Details | ||
| The `nodeHasVolumesAttached()` function (lines 537–553 of `reconciler.go`) simply returns `len(node.Status.VolumesAttached) != 0`. When true, the reconciler attempts `deleteUnevictedPods()`, which only deletes pods already in `Terminating` state on unreachable nodes. DaemonSet pods are excluded from standard node drain and are never evicted, so they remain in `Running` state — invisible to `deleteUnevictedPods()`. If those DaemonSet pods have NFS volume mounts, the `VolumeAttachment` objects persist, `VolumesAttached` remains non-empty, and the machine stays in `Deleting` indefinitely. | ||
| The built-in recovery (`deleteUnevictedPods`) logs `Deleted 0 pods` on every reconcile cycle because the DaemonSet pods are not in `Terminating` state. | ||
| ## Expected Behavior | ||
| The machine controller should distinguish between VMDK-backed volumes (where data loss is a real risk) and non-VMDK volumes (NFS, iSCSI, etc.) where the vSphere `Destroy_Task` data loss concern does not apply. | ||
| ## Actual Behavior | ||
| Machine remains stuck in `Deleting` state indefinitely. Manual intervention is required (applying the `node.kubernetes.io/out-of-service` taint, or manually deleting `VolumeAttachment` objects) to unblock. | ||
|
|
||
| --- | ||
|
|
||
| ## Fix Plan | ||
|
|
||
| **Approach:** Modify `nodeHasVolumesAttached()` to only block deletion for vSphere-backed volumes. | ||
|
|
||
| ### Implementation | ||
|
|
||
| **File: `pkg/controller/vsphere/reconciler.go`** | ||
|
|
||
| 1. Add constants for vSphere attacher names: | ||
| - `VSphereCSIDriverName = "csi.vsphere.vmware.com"` | ||
| - `VSphereInTreePluginName = "kubernetes.io/vsphere-volume"` | ||
|
|
||
| 2. Rewrite `nodeHasVolumesAttached()` to: | ||
| - Iterate over `node.Status.VolumesAttached` | ||
| - For each volume, fetch the corresponding `VolumeAttachment` by name (`AttachedVolume.Name` = VolumeAttachment name) | ||
| - Check `VolumeAttachment.Spec.Attacher`: | ||
| - If vSphere CSI or in-tree → volume is VMDK-backed → block deletion | ||
| - If non-vSphere (NFS, iSCSI, etc.) → skip, no data loss risk | ||
| - Return `true` only if vSphere-backed volumes are found | ||
| - Conservative error handling: if VolumeAttachment lookup fails or attacher is unknown, treat as potentially risky and block | ||
| - Log all volumes being checked and which ones are blocking deletion | ||
|
|
||
| ### Unit Tests | ||
|
|
||
| **File: `pkg/controller/vsphere/reconciler_test.go`** | ||
|
|
||
| Add test cases: | ||
| - NFS volumes attached → deletion proceeds (no block) | ||
| - vSphere CSI volumes attached → deletion blocked | ||
| - Mixed volumes (NFS + vSphere) → deletion blocked | ||
| - Non-vSphere attacher (iSCSI, etc.) → deletion proceeds (no block) | ||
|
|
||
| ### E2E Tests | ||
|
|
||
| **File: `test/e2e/vsphere/machines.go`** (or appropriate existing e2e test file) | ||
|
|
||
| Add e2e test scenario (requires NFS CSI driver like NetApp/Trident): | ||
| - Create a Machine with an NFS-backed PVC mounted (via DaemonSet or similar) | ||
| - Trigger machine deletion | ||
| - Verify machine completes deletion without getting stuck, even with NFS `VolumeAttachment` objects still present | ||
| - Confirm VM is destroyed in vSphere | ||
|
|
||
| Note: This test requires an NFS CSI driver installed in the cluster. If unavailable, can be validated manually or via integration tests. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.