Skip to content

STOR-3090: Add CSI storage test for pod delete after host umount of mounted volume - #31488

Open
radeore wants to merge 1 commit into
openshift:mainfrom
radeore:vol-umount-test
Open

STOR-3090: Add CSI storage test for pod delete after host umount of mounted volume#31488
radeore wants to merge 1 commit into
openshift:mainfrom
radeore:vol-umount-test

Conversation

@radeore

@radeore radeore commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add CSI suite OpenShift CSI extended - Pod delete after umount (migrated from openshift tests private OCP-66187).
  • Added podDeleteAfterUmount capability to enable volume umount test
  • Register this test suite in registerAlwaysOnCSISuites but executes only when the podDeleteAfterUmount capability is set 'true' in CSI driver manifest.yaml.

Test plan

  • make openshift-tests
  • Dry-run: ./openshift-tests run openshift/csi --dry-run | grep 'Pod delete after umount'
  • Run against multiple CSI drivers (GCP PD, Azure Disk, Azure File)

Test run logs:

Ran 1 of 1 Specs in 26.038 seconds
  SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
[
  {
    "name": "External Storage [Driver: pd.csi.storage.gke.io] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node",
    "result": "passed"
---
Ran 1 of 1 Specs in 34.894 seconds
  SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
[
  {
    "name": "External Storage [Driver: file.csi.azure.com] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node",
     "result": "passed"
  
--- 

 Ran 1 of 1 Specs in 61.331 seconds
  SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
[
  {
    "name": "External Storage [Driver: disk.csi.azure.com] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node",
    

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added an optional CSI storage test verifying successful pod deletion after a host-side volume unmount.
    • The test provisions and mounts a volume, validates the mount, removes it, and confirms cleanup.
    • The test is disabled by default and can be enabled through configuration.
  • Documentation
    • Documented how to enable the optional CSI test and its default behavior.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 5, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 5, 2026

Copy link
Copy Markdown

@radeore: This pull request references STOR-3090 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Add CSI suite OpenShift CSI extended - Pod delete after umount (migrated from openshift tests private OCP-66187).
  • Register via RegisterAlwaysOnCSISuites so it runs for all CSI drivers in openshift/csi.

Test plan

  • make openshift-tests
  • Dry-run: ./openshift-tests run openshift/csi --dry-run | grep 'Pod delete after umount'
  • Run against at least one driver (GCP PD)

Test run logs:

Ran 1 of 1 Specs in 26.038 seconds
 SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
[
 {
   "name": "External Storage [Driver: pd.csi.storage.gke.io] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node",
   "lifecycle": "blocking",
   "duration": 26038,
   "startTime": "2026-08-05 20:46:00.551357 UTC",
   "endTime": "2026-08-05 20:46:26.589434 UTC",
   "result": "passed"

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Walkthrough

Adds an optional OpenShift CSI test suite. The suite dynamically provisions a volume, mounts it in a pod, unmounts it on the host, removes the volume directory, and verifies successful pod deletion.

Changes

CSI pod deletion validation

Layer / File(s) Summary
Suite configuration and registration
test/extended/storage/csi/csi.go, test/extended/storage/csi/README.md, test/extended/storage/csi/pod_delete_after_umount.go
Adds the PodDeleteAfterUmountTest option, documents its disabled default, and registers the suite when enabled.
Volume and pod setup
test/extended/storage/csi/pod_delete_after_umount.go
Creates a dynamic filesystem volume and pod, then verifies the CSI mount on the pod’s node.
Host unmount and pod deletion
test/extended/storage/csi/pod_delete_after_umount.go
Unmounts and removes the host volume directory, verifies the unmount, and requires pod deletion to complete successfully.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StorageFramework
  participant KubernetesAPI
  participant HostExecution
  StorageFramework->>KubernetesAPI: Create volume and pod
  KubernetesAPI-->>StorageFramework: Return bound PV and pod node
  StorageFramework->>HostExecution: Verify CSI mount path
  StorageFramework->>HostExecution: Unmount and remove volume directory
  HostExecution-->>StorageFramework: Confirm path is not mounted
  StorageFramework->>KubernetesAPI: Delete pod
  KubernetesAPI-->>StorageFramework: Complete pod deletion
Loading

Suggested reviewers: bertinatto, tsmetana


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Container-Privileges ❌ Error The new suite sets NamespacePodSecurityLevel to LevelPrivileged and calls NewHostExec, which creates a hostNetwork pod with Privileged=true. Avoid privileged host execution where possible, or document and isolate the required hostNetwork/privileged pod with the minimum necessary security settings.
No-Sensitive-Data-In-Logs ❌ Error The suite logs node.Name in a Ginkgo step and passes mount paths containing pod UIDs/PV names to HostExec, whose error logger emits the remote host and command. Use redacted, opaque identifiers in steps and errors, and prevent HostExec failure logs from emitting node names or full mount paths.
✅ Passed checks (13 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The added Ginkgo test title and suite name are fixed descriptive strings; no pod, node, namespace, timestamp, IP, UUID, or generated value appears in a test title.
Test Structure And Quality ✅ Passed The single It tests one behavior, defers pod/volume/host cleanup, uses f.Timeouts.PodStart and finite delete/provision waits, and supplies diagnostic messages for all direct assertions.
Microshift Test Compatibility ✅ Passed The new Ginkgo test uses core Kubernetes CSI, PVC, Pod, Node, and privileged host-exec APIs; it references no unavailable OpenShift API, namespace, or MicroShift-unsupported topology feature.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new suite creates one pod, uses its assigned node for host mount operations, and has no multi-node, HA, anti-affinity, spreading, failover, or rescheduling assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The patch changes CSI documentation/configuration and an e2e test only; it adds no Deployment, controller, affinity, topology spread, node selector, toleration, replica, or PDB constraints.
Ote Binary Stdout Contract ✅ Passed The PR adds no process-level stdout writes. csi.go uses fmt.Errorf, and the new suite’s formatting and Ginkgo actions run inside test registration or It; no main, init, log, or klog changes were ad...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new Ginkgo test uses only Kubernetes APIs, host mount commands, and filepath.Join; it has no IPv4 literals, IP parsing, URL construction, or external network calls, and its test image is mirror...
No-Weak-Crypto ✅ Passed The patch adds CSI test/configuration/docs only; exact diff and structural scans show no weak crypto algorithms, crypto APIs, custom crypto, or secret/token comparisons.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the new CSI test for pod deletion after host unmount of a mounted volume.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: radeore
Once this PR has been reviewed and has the lgtm label, please assign jsafrane for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 requested review from bertinatto and tsmetana August 5, 2026 21:00
@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Aug 5, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-trt

openshift-trt Bot commented Aug 6, 2026

Copy link
Copy Markdown

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New Test Risks for sha: ccd7e34

Job Name New Test Risk
pull-ci-openshift-origin-main-e2e-aws-csi Medium - "External Storage [Driver: ebs.csi.aws.com] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node" is a new test, and was only seen in one job.
pull-ci-openshift-origin-main-e2e-gcp-csi Medium - "External Storage [Driver: pd.csi.storage.gke.io] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node" is a new test, and was only seen in one job.

New tests seen in this PR at sha: ccd7e34

  • "External Storage [Driver: ebs.csi.aws.com] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node" [Total: 1, Pass: 1, Fail: 0, Flake: 0]
  • "External Storage [Driver: pd.csi.storage.gke.io] [Testpattern: Dynamic PV (default fs)] OpenShift CSI extended - Pod delete after umount should delete pod after volume directory was umounted on the node" [Total: 1, Pass: 1, Fail: 0, Flake: 0]

@radeore

radeore commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@jsafrane

Copy link
Copy Markdown
Contributor

/testwith openshift/csi-operator#596

@jsafrane

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/e2e-aws-csi openshift/csi-operator#596

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@jsafrane, testwith: Error processing request. ERROR:

could not determine job runs: requested job is invalid. needs to be formatted like: <org>/<repo>/<branch>/<variant?>/<job>. instead it was: openshift/origin/e2e-aws-csi

@jsafrane

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/master/e2e-aws-csi openshift/csi-operator#596

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@jsafrane, testwith: could not generate prow job. ERROR:

could not determine ci op config from metadata: got unexpected http 404 status code from configresolver: failed to get config: could not find any config for branch master on repo openshift/origin

@jsafrane

Copy link
Copy Markdown
Contributor

/testwith openshift/origin/main/e2e-aws-csi openshift/csi-operator#596

Comment thread test/extended/storage/csi/csi.go Outdated
Comment thread test/extended/storage/csi/csi.go Outdated
Comment thread test/extended/storage/csi/README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/extended/storage/csi/pod_delete_after_umount.go`:
- Around line 97-99: Update the unmount command in the volume cleanup step of
the pod deletion test to use forced unmount (`umount -f`) before removing the
directory. Keep the existing command sequencing and error validation unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 63789436-4e23-4887-a052-8479b8f6a7b2

📥 Commits

Reviewing files that changed from the base of the PR and between 31cba00 and e8f1333.

📒 Files selected for processing (3)
  • test/extended/storage/csi/README.md
  • test/extended/storage/csi/csi.go
  • test/extended/storage/csi/pod_delete_after_umount.go

Comment on lines +97 to +99
g.By("Unmounting and removing the volume directory on the node")
err = hostExec.IssueCommand(ctx, fmt.Sprintf("umount %q && rmdir %q", mountPath, mountPath), node)
e2e.ExpectNoError(err, "umount and rmdir of volume mount path %s", mountPath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a forced unmount for this test scenario.

Line 98 uses normal umount. The suite contract requires validation after a force-unmount. This command can test a different cleanup path and leave the intended regression untested. Add -f.

Proposed fix
- err = hostExec.IssueCommand(ctx, fmt.Sprintf("umount %q && rmdir %q", mountPath, mountPath), node)
+ err = hostExec.IssueCommand(ctx, fmt.Sprintf("umount -f %q && rmdir %q", mountPath, mountPath), node)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
g.By("Unmounting and removing the volume directory on the node")
err = hostExec.IssueCommand(ctx, fmt.Sprintf("umount %q && rmdir %q", mountPath, mountPath), node)
e2e.ExpectNoError(err, "umount and rmdir of volume mount path %s", mountPath)
g.By("Unmounting and removing the volume directory on the node")
err = hostExec.IssueCommand(ctx, fmt.Sprintf("umount -f %q && rmdir %q", mountPath, mountPath), node)
e2e.ExpectNoError(err, "umount and rmdir of volume mount path %s", mountPath)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/extended/storage/csi/pod_delete_after_umount.go` around lines 97 - 99,
Update the unmount command in the volume cleanup step of the pod deletion test
to use forced unmount (`umount -f`) before removing the directory. Keep the
existing command sequencing and error validation unchanged.

@radeore

radeore commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

/testwith openshift/origin/main/e2e-aws-csi openshift/csi-operator#596

@radeore

radeore commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

/test images

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@radeore: The following tests 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/e2e-aws-ovn-microshift-serial e8f1333 link true /test e2e-aws-ovn-microshift-serial
ci/prow/e2e-gcp-ovn e8f1333 link true /test e2e-gcp-ovn
ci/prow/e2e-gcp-csi e8f1333 link true /test e2e-gcp-csi
ci/prow/e2e-gcp-ovn-upgrade e8f1333 link true /test e2e-gcp-ovn-upgrade

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.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants