Skip to content

[cinder-csi-plugin] Add mkfsOptions StorageClass parameter#3084

Open
rybnico wants to merge 1 commit intokubernetes:masterfrom
rybnico:feature/add-mkfs-options
Open

[cinder-csi-plugin] Add mkfsOptions StorageClass parameter#3084
rybnico wants to merge 1 commit intokubernetes:masterfrom
rybnico:feature/add-mkfs-options

Conversation

@rybnico
Copy link
Copy Markdown

@rybnico rybnico commented Mar 17, 2026

What this PR does / why we need it:

Add support for a new mkfsOptions StorageClass parameter that allows cluster admins to pass custom mkfs flags when formatting volumes. This is particularly useful for Ceph-backed storage where passing -E nodiscard to mkfs.ext4 can dramatically speed up provisioning (e.g. from ~7 minutes to seconds for a 100 GB volume).

The parameter value is comma-separated, with each token further split on whitespace to produce individual mkfs command-line arguments. Example: mkfsOptions: "-E nodiscard,-O ^metadata_csum"

Implementation:

  • Extract mkfsOptions from StorageClass params in CreateVolume and pass via VolumeContext (both new-volume and idempotent early-return paths)
  • Parse mkfsOptions in NodeStageVolume using parseMkfsOptions() helper
  • Use FormatAndMountSensitiveWithFormatOptions() from k8s.io/mount-utils to pass format options separately from mount options
  • No behavior change when mkfsOptions is not set

Which issue this PR fixes(if applicable):
fixes #3068

Special notes for reviewers:
Inspired by the Ceph CSI implementation (ceph/ceph-csi#621).

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 17, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 17, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: rybnico / name: Nico (d7fa2d8)

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 17, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @rybnico. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 17, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign stephenfin 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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 17, 2026
Add support for a new `mkfsOptions` StorageClass parameter that allows
cluster admins to pass custom mkfs flags when formatting volumes. This
is particularly useful for Ceph-backed storage where passing
`-E nodiscard` to mkfs.ext4 can dramatically speed up provisioning
(e.g. from ~7 minutes to seconds for a 100 GB volume).

The parameter value is comma-separated, with each token further split
on whitespace to produce individual mkfs command-line arguments.
Example: `mkfsOptions: "-E nodiscard,-O ^metadata_csum"`

Implementation:
- Extract mkfsOptions from StorageClass params in CreateVolume and pass
  via VolumeContext (both new-volume and idempotent early-return paths)
- Parse mkfsOptions in NodeStageVolume using parseMkfsOptions() helper
- Use FormatAndMountSensitiveWithFormatOptions() from k8s.io/mount-utils
  to pass format options separately from mount options
- No behavior change when mkfsOptions is not set

Inspired by the Ceph CSI implementation (ceph/ceph-csi#621).
@rybnico rybnico force-pushed the feature/add-mkfs-options branch from 5c03378 to d7fa2d8 Compare March 25, 2026 15:26
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cinder-csi-plugin] Add 'mkfsOptions' parameter

2 participants