Skip to content
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

Add support for mount options to CSI drivers #67898

Merged
merged 2 commits into from
Oct 31, 2018

Conversation

bswartz
Copy link
Contributor

@bswartz bswartz commented Aug 27, 2018

Declare support for mount option in CSI drivers, and implement usage for the mountOptions field of the storage class when invoking CSI RPCs that accept mount options.

Fixes #67897

CSI drivers now have access to mountOptions defined on the storage class when attaching volumes.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. 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. sig/storage Categorizes an issue or PR as relevant to SIG Storage. labels Aug 27, 2018
@jsafrane
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 27, 2018
Copy link
Contributor

@j-griffith j-griffith left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -288,7 +288,10 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
func (p *csiPlugin) SupportsMountOption() bool {
// TODO (vladimirvivien) use CSI VolumeCapability.MountVolume.mount_flags
// to probe for the result for this method
return false
// (bswartz) Until the CSI spec supports probing, our only option is to
Copy link
Member

Choose a reason for hiding this comment

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

I'm looking at the CSI spec and I think that every driver should support mount_flags. Of course, a driver may return some error when an invalid flag is set (or even when any flag is set), but that's up to system admin to fix.

I think we don't need the comments around and we can return true without any regrets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well one could imagine a CSI driver that doesn't support mount options yet, or for which mount options are irrelevant. In those cases, returning false here would allow kubernetes to report an actual useful error message instead of hiding any error messages down in some CSI driver log or silently ignoring mount options.

Copy link
Member

Choose a reason for hiding this comment

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

The CSI spec says that the all the volume capabilities must be validated by the driver. So a properly implemented CSI driver should error on any invalid or unsupported volume capability.

The question I have is what happens in the future if a new volume capability is added? Will plugins have to explicitly upgrade their proto version to see the new field or will it show up as an optional pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't answer the question about future capabilities and how existing drivers can validate them, but I agree with your point about existing validation of mount options. A driver has the ability to reject requests with mount option now, if it doesn't support them. Of course drivers can also silently ignore them, but there's not much we can do about that.

Copy link
Member

Choose a reason for hiding this comment

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

The CSI spec says that the all the volume capabilities must be validated by the driver. So a properly implemented CSI driver should error on any invalid or unsupported volume capability.

The question I have is what happens in the future if a new volume capability is added? Will plugins have to explicitly upgrade their proto version to see the new field or will it show up as an optional pointer?

Good question. AFAIK proto backwards compat means that it won't show up in the request. Should bring this up in the CSI community meeting.

@@ -288,7 +288,10 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
func (p *csiPlugin) SupportsMountOption() bool {
// TODO (vladimirvivien) use CSI VolumeCapability.MountVolume.mount_flags
// to probe for the result for this method
return false
// (bswartz) Until the CSI spec supports probing, our only option is to
Copy link
Member

Choose a reason for hiding this comment

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

The CSI spec says that the all the volume capabilities must be validated by the driver. So a properly implemented CSI driver should error on any invalid or unsupported volume capability.

The question I have is what happens in the future if a new volume capability is added? Will plugins have to explicitly upgrade their proto version to see the new field or will it show up as an optional pointer?

@@ -186,6 +186,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
attribs,
nodePublishSecrets,
fsType,
c.spec.PersistentVolume.Spec.MountOptions,
Copy link
Member

Choose a reason for hiding this comment

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

Unit tests?

@bswartz
Copy link
Contributor Author

bswartz commented Oct 12, 2018

Rebased and added unit tests

@msau42
Copy link
Member

msau42 commented Oct 27, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2018
@msau42
Copy link
Member

msau42 commented Oct 27, 2018

/assign @jsafrane

@jsafrane
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bswartz, jsafrane

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 Oct 30, 2018
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

2 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@bswartz
Copy link
Contributor Author

bswartz commented Oct 31, 2018

/retest

This pull request was closed.
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. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants