Skip to content

Derive access mode from the CreateVolume request instead of parameters #1945

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

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

tonyzhc
Copy link
Contributor

@tonyzhc tonyzhc commented Feb 20, 2025

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind bug

What this PR does / why we need it:

Previously #1919 introduces multi-writer mode support for hyperdisks, but the access mode was derived through the parameters list. This is not the standard Kubernetes way of configuring access mode; rather we should derive it from the Volume Capabilities list in the CreateVolume request. This would confuse customers if they provide conflicting information in StorageClass vs PVC.

Which issue(s) this PR fixes:

Fixes b/397726676.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 20, 2025
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 20, 2025
@tonyzhc
Copy link
Contributor Author

tonyzhc commented Feb 20, 2025

/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 20, 2025
@tonyzhc tonyzhc closed this Feb 20, 2025
@tonyzhc tonyzhc reopened this Feb 20, 2025
@tonyzhc
Copy link
Contributor Author

tonyzhc commented Feb 20, 2025

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 20, 2025
@mattcary
Copy link
Contributor

Thanks for sorting this out, @tonyzhc !

one minor comment above

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 20, 2025
@tonyzhc
Copy link
Contributor Author

tonyzhc commented Feb 20, 2025

/retest

multiWriter := false
if common.IsHyperdisk(params.DiskType) {
if !disksWithUnsettableAccessMode[params.DiskType] {
if am, err := getHyperdiskAccessModeFromCapabilities(req.GetVolumeCapabilities()); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just making sure I understand, this check is actually redundant, as we should prevent unsettable access modes from getting set up in createVolumeInternal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this because we could still derive "READ_WRITE_SINGLE" from the volume capabilities, which is a valid mode for these disks; createVolumeInternal only throws error if the volume capabilities contain multi-node access modes (namely "READ_WRITE_MANY" and "READ_ONLY_MANY").

Copy link
Contributor

Choose a reason for hiding this comment

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

So if this is an unsettable type (HdT etc), then we'll silently ignore req.GetVolumeCapabilities (or at least the access mode from them)? I'm not sure that's right, I think we should error if disksWithUnsettableAccessMode && am != RW_SINGLE.

Or am I getting confused about something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That check is performed somewhere else (see other comment). Let me know if you think there's improvement I can make here to make the code more understandable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should return an error if disksWithUnsettableAccessMode[params.DiskType] == true here, even if it's redundant with the check above. It will save us if there is a future refactor that changes the order of validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, done.

@mattcary
Copy link
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, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattcary, tonyzhc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 25, 2025
@mattcary
Copy link
Contributor

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Feb 25, 2025

@tonyzhc: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019 9d8100d link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@tonyzhc
Copy link
Contributor Author

tonyzhc commented Feb 25, 2025

Looks like the integration tests are failing with the same volume snapshot flakes.

@k8s-ci-robot k8s-ci-robot merged commit 39a5910 into kubernetes-sigs:master Feb 25, 2025
7 of 8 checks passed
@mattcary
Copy link
Contributor

The windows test isn't required, so this was able to merge. The main e2e passed (the snapshot tests are just flakey IIUC)

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. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants