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

Proposal for taking mount option to GA #771

Merged
merged 2 commits into from
Aug 17, 2017

Conversation

gnufied
Copy link
Member

@gnufied gnufied commented Jun 29, 2017

Also add support for specifying mount options
in storage classes.

cc @kubernetes/sig-storage-api-reviews @liggitt

Also add support for specifying mount options
in storage classes.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 29, 2017
@ianchakeres
Copy link
Contributor

/sig storage

and added as a field to PVs.

If admin has configured mount option for a storage type that does not support mount options,
then `mountOptions` parameter will be simply ignored for such volume types. Also, if configured
Copy link
Contributor

Choose a reason for hiding this comment

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

we have always returned a "provisioning failed" error when the storageclass has an invalid/unrecognized param

Copy link
Member Author

Choose a reason for hiding this comment

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

That seems correct, updating the proposal to reflect this.


## Preventing users from specifying mount options in inline volume specs of Pod

While mount options enable more flexibility in how volumes are mounted, it can result
in user specifying options that are not supported or are known to be problematic when
using inline volume specs.

After much deliberation it was decided that - `mount-options` as an API parameter will not be supported
After much deliberation it was decided that - `mountOptions` as an API parameter will not be supported
Copy link
Member

Choose a reason for hiding this comment

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

will the volume source API structs used within a PV be cloned to add this new field?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the mountOptions is not a field of volume source APIs. It is a field of PV itself as proposed above

@gnufied
Copy link
Member Author

gnufied commented Jul 12, 2017

@liggitt @saad-ali ping on this one again.

@nrvnrvn
Copy link

nrvnrvn commented Jul 13, 2017

Imagine I want to mount /tmp as an EmptyDir of medium: Memory.
The recommendation is to mount /tmp with nosuid,nodev,noexec options. And this is what I see when running docker run --tmpfs /tmp:

tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime)

But in kubernetes I observe:

tmpfs on /tmp type tmpfs (rw,relatime)

The proposal mentions PersistentVolumes and StorageClasses but how could one pass proper options to the EmptyDir?

@nrvnrvn
Copy link

nrvnrvn commented Jul 13, 2017

err. it looks impossible atm https://github.com/kubernetes/kubernetes/blob/74f19437742abcff81510dc347f2cc70ec190e99/pkg/volume/empty_dir/empty_dir.go#L258
And it turns out that the emptydir case is beyond the proposal...

provisioner: kubernetes.io/glusterfs
parameters:
type: gp2
mountOptions: "auto_mount"
Copy link
Member Author

Choose a reason for hiding this comment

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

To continue on discussion from sig meeting today. @saad-ali I think having this in parameters frees us from having to perform validation of storageclass itself and such decision can be deferred to individual provisioner.

Copy link
Member

Choose a reason for hiding this comment

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

I think mountOptions should be a first class field in the StorageClass because it is controlling a first class field in the PV object (not specific to a single volume plugin). As far as validation is concerned, for in-tree plugins you can call SupportsMountOption(...) on the provisioner. The tricky bit will be how to pass this through for out-of-tree volume provisioners, but that problem needs to be solved for reclaimPolicy (kubernetes/kubernetes#47987) as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree it should be 1st class for that reason.

I think the reason gnufied is hesitant to do create-time validation is we actually can't call SupportsMountOption due to, iirc, the cost of importing all the volume plugin code into the validation code. But that was resolved, even if it was a bit ugly..

It's true if we do create-time validation of storageClass.mountOptions for in-tree plugins there will be some asymmetry between in- & out-. But I don't think solving that is worth it. While admins deploying out-of-tree provisioners may appreciate the upfront warning that they've configured their storageClass with an unsupported mountOptions field, realistically they care more about mistakes in the parameters field which won't show up until run-time anyway... So I think they'll settle for run-time validation of storageClass.mountOptions.

Plus, this problem shouldn't exist for reclaimPolicy because every plugin already supports Retain, they can't opt-out of that like they can mount options.

Copy link
Member Author

@gnufied gnufied Aug 23, 2017

Choose a reason for hiding this comment

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

I am fine making it first class field on StorageClass. The minor catch is - we can't really do creation time validation of storageClass for verifying if it supports mount options without hardcoding name of volume plugins that will support it (like literally hardcoding plugin name strings).

But I think that is relatively minor issue, because in my quick survey all volume types that support dynamic provisioning also support mount options (i.e at plugin level in current master) and hence there is no practical benefit of validation the SC for mount options during creation. So, what we can do is:

  1. Make mountOption first class field for StorageClass.
  2. Don't do any validation of mount option when storageClass is created.
  3. Perform provisioning time SupportsMountOption validation and check if mount option is supported. This is really just a safety net. As I said above, all volume types that support dynamic provisioning also support mount options - so for most part this check will always be successful. Also, even if we didn't check during provisioning the PV creation will be anyways rejected if volume type doesn't support 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.

  1. Make mountOption first class field for StorageClass.
  2. Don't do any validation of mount option when storageClass is created.
  3. Perform provisioning time SupportsMountOption validation and check if mount option is supported. This is really just a safety net. As I said above, all volume types that support dynamic provisioning also support mount options - so for most part this check will always be successful. Also, even if we didn't check during provisioning the PV creation will be anyways rejected if volume type doesn't support mount options.

SGTM!

@saad-ali saad-ali added the sig/storage Categorizes an issue or PR as relevant to SIG Storage. label Jul 28, 2017
```


Beta support for mount options introduced via `mount-options` annotation will be supported for near future
Copy link
Member

Choose a reason for hiding this comment

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

Beta -> Alpha?

Copy link
Member Author

Choose a reason for hiding this comment

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


## Preventing users from specifying mount options in inline volume specs of Pod

While mount options enable more flexibility in how volumes are mounted, it can result
in user specifying options that are not supported or are known to be problematic when
using inline volume specs.

After much deliberation it was decided that - `mount-options` as an API parameter will not be supported
After much deliberation it was decided that - `mountOptions` as an API parameter will not be supported
for inline volume specs.
Copy link
Member

@rata rata Jul 30, 2017

Choose a reason for hiding this comment

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

So, if I understand correctly, this won't be possible to specify on pod.spec.volumes, right? I mean, as in a pod, that you can specify a volume and fsType, like in the example here: https://kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore

Can you please elaborate on the much deliberation?

Don't get me wrong, I'm not saying I'm against it, I just want to understand a little more. It seems weird that you can have the fsType there but not mountOptions. But I understand that pvs and pvc are preferred now, also.

So, if you have some time, can I ask what was taken into account on this deliberation, the trade offs of different approaches considered, etc.? Something high level is fine. I understand it's a busy time on the release, so no worries if you can't :)

Copy link
Member Author

@gnufied gnufied Jul 31, 2017

Choose a reason for hiding this comment

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

I think bulk of discussion is here - #321 (review)

The tldr; of the discussion is - allowing normal users to specify mountOptions can enable users to compromise the host operating system itself. Users can disable selinux or can cause kernel panic which would crash the host operating system. That is why mount option should be carefully controlled.

Copy link
Member

@rata rata Jul 31, 2017

Choose a reason for hiding this comment

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

@thanks a lot for the link! I guess I'm with @saad-ali, but all makes sense and it's nice to see the background. Thanks :)

then a "provisioning failed" event will be added to PVC and PVC will stay in pending state.

Also, if configured mount option is invalid then corresponding mount time failure error will be added to pod object.


## Preventing users from specifying mount options in inline volume specs of Pod

While mount options enable more flexibility in how volumes are mounted, it can result
in user specifying options that are not supported or are known to be problematic when
using inline volume specs.
Copy link
Member

Choose a reason for hiding this comment

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

When using inline volumes? What is more problematic about an in-line volume? Coordinate the fsType and the mount options? If that guess is on track, then it's more problematic for file-system dependent mount options (there are file-system independent options too) and when not specifyng in-line the fsType?

Copy link
Member Author

Choose a reason for hiding this comment

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

responded above.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks again! :)

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 15, 2017
@childsb
Copy link
Contributor

childsb commented Aug 17, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 17, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c21e730 into kubernetes:master Aug 17, 2017
k8s-github-robot pushed a commit to kubernetes/kubernetes that referenced this pull request Aug 29, 2017
Automatic merge from submit-queue (batch tested with PRs 50919, 51410, 50099, 51300, 50296)

Take mount options to GA by adding PV.spec.mountOptions

**What this PR does / why we need it**: Implements kubernetes/community#771

issue: kubernetes/enhancements#168

**Special notes for your reviewer**:

TODO:
- ~StorageClass mountOptions~

As described in proposal, this adds PV.spec.mountOptions + mountOptions parameter to every plugin that is both provisionable & supports mount options.

(personally, even having done all the work already, i don't agree w/ the proposal that mountOptions should be SC parameter but... :))

**Release note**:

```release-note
Add mount options field to PersistentVolume spec
```
MadhavJivrajani pushed a commit to MadhavJivrajani/community that referenced this pull request Nov 30, 2021
Automatic merge from submit-queue

Proposal for taking mount option to GA

Also add support for specifying mount options
in storage classes.

cc @kubernetes/sig-storage-api-reviews @liggitt
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.