Skip to content

util: improve static PV handling - #6328

Open
satoru-takeuchi wants to merge 1 commit into
ceph:develfrom
satoru-takeuchi:improve-static-volume-handling
Open

util: improve static PV handling#6328
satoru-takeuchi wants to merge 1 commit into
ceph:develfrom
satoru-takeuchi:improve-static-volume-handling

Conversation

@satoru-takeuchi

Copy link
Copy Markdown
Contributor

Describe what this PR does

  • Clarify static PV must not specify controllerPublishSecretRef.
  • Improve handling volumeHandle validation error. This error is harmless for static volume and is a real error for other volumes.

The related discussion:
#6290

Is there anything that requires special attention

This PR hardens the spec of static PVs. However, I believe it's not such a big problem since admins have already suffered from troubles if controllerPublishSecretRef is specified on static volumes. For instance, ControllerUnpublishVolume fails forever in GenVolFromVolID unless volumeHandle validation succeeds by accident.

Related issues

Nothing.

Future concerns

Nothing.

Checklist:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull
    Request
  • Pending release
    notes

    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

@mergify mergify Bot added ci/skip/e2e skip running e2e CI jobs ci/skip/multi-arch-build skip building on multiple architectures component/docs Issues and PRs related to documentation labels Jun 9, 2026
@satoru-takeuchi satoru-takeuchi changed the title doc: improve static PV handling util: improve static PV handling Jun 9, 2026
@satoru-takeuchi
satoru-takeuchi force-pushed the improve-static-volume-handling branch from 9a65e64 to eb95e05 Compare June 9, 2026 07:46
@satoru-takeuchi

Copy link
Copy Markdown
Contributor Author

I couldn't find the best component of commit subjects since my change spread over rbd, cephfs, and nvmof. Although I set "util" as component of commit subjects, please let me know if there is more appropriate component.

https://github.com/ceph/ceph-csi/blob/devel/docs/development-guide.md#commit-messages

Comment thread internal/util/util.go Outdated
// IsOlderOrStaticPV returns true when the error from GetControllerPublishSecretRef indicates
// that the volume is either a static PV (non-CSI-formatted volume handle) or an older PV
// provisioned without a controller-publish secret configured.
func IsOlderOrStaticPV(err error) bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesnt look like the nice check. because we might get this errors on some corner cases, we should not be considering this errors as the source of truth to identify if its a static volume or not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see. My intention is to clarify the early returns can also happen if the target volume is static volume in addition to older volume. In addition, Early return is unavoidable even in corner cases.

How about changing the function name (e.g. ShouldSkipControllerPublishSecret)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Madhu-1 I changed my mind. I created a helper function (GetControllerPublishSecrets) to get the secret and decide whether the handler return early rather than creating a helper(ShouldSkipControllerPublishSecret) just for skip decision.

Please review this PR again.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks much better than earlier implementation, i have requested for reviews

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could you review this PR?

@satoru-takeuchi
satoru-takeuchi force-pushed the improve-static-volume-handling branch 2 times, most recently from 0e1662c to 81adf59 Compare June 19, 2026 04:13
- Clarify static PV must not specify controllerPublishSecretRef.
- Improve handling volumeHandle validation error.

The related discussion:
ceph#6290

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
@satoru-takeuchi
satoru-takeuchi force-pushed the improve-static-volume-handling branch from 81adf59 to 5be7488 Compare June 19, 2026 04:17
@satoru-takeuchi
satoru-takeuchi requested a review from Madhu-1 June 19, 2026 04:38
@Madhu-1
Madhu-1 requested a review from a team June 25, 2026 07:36

@Madhu-1 Madhu-1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

changes LGTM, we need to update the doc about what functionality user will not get if they dont set the secretRef

Comment thread docs/static-pvc.md
@Madhu-1
Madhu-1 requested a review from a team July 24, 2026 05:52
@Madhu-1 Madhu-1 removed the ci/skip/e2e skip running e2e CI jobs label Jul 24, 2026
@Madhu-1

Madhu-1 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.36/cephfs

@Madhu-1

Madhu-1 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.36/rbd

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

Labels

ci/skip/multi-arch-build skip building on multiple architectures component/docs Issues and PRs related to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants