Skip to content
Snippets Groups Projects
Commit a75f92aa authored by Matthew Wong's avatar Matthew Wong
Browse files

Override mountOptions parameter with sc.mountOptions

parent 1ad62801
Branches
Tags
No related merge requests found
...@@ -3,5 +3,5 @@ apiVersion: storage.k8s.io/v1 ...@@ -3,5 +3,5 @@ apiVersion: storage.k8s.io/v1
metadata: metadata:
name: example-nfs name: example-nfs
provisioner: example.com/nfs provisioner: example.com/nfs
parameters: mountOptions:
mountOptions: "vers=4.1" # TODO: reconcile with StorageClass.mountOptions - vers=4.1
...@@ -7,7 +7,7 @@ Edit the `provisioner` field in `deploy/kubernetes/class.yaml` to be the provisi ...@@ -7,7 +7,7 @@ Edit the `provisioner` field in `deploy/kubernetes/class.yaml` to be the provisi
### Parameters ### Parameters
* `gid`: `"none"` or a [supplemental group](http://kubernetes.io/docs/user-guide/security-context/) like `"1001"`. NFS shares will be created with permissions such that pods running with the supplemental group can read & write to the share, but non-root pods without the supplemental group cannot. Pods running as root can read & write to shares regardless of the setting here, unless the `rootSquash` parameter is set true. If set to `"none"`, anybody root or non-root can write to the share. Default (if omitted) `"none"`. * `gid`: `"none"` or a [supplemental group](http://kubernetes.io/docs/user-guide/security-context/) like `"1001"`. NFS shares will be created with permissions such that pods running with the supplemental group can read & write to the share, but non-root pods without the supplemental group cannot. Pods running as root can read & write to shares regardless of the setting here, unless the `rootSquash` parameter is set true. If set to `"none"`, anybody root or non-root can write to the share. Default (if omitted) `"none"`.
* `rootSquash`: `"true"` or `"false"`. Whether to squash root users by adding the NFS Ganesha root_id_squash or kernel root_squash option to each export. Default `"false"`. * `rootSquash`: `"true"` or `"false"`. Whether to squash root users by adding the NFS Ganesha root_id_squash or kernel root_squash option to each export. Default `"false"`.
* `mountOptions`: a comma separated list of [mount options](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options) for every PV of this class to be mounted with. The list is inserted directly into every PV's mount options annotation/field without any validation. Default blank `""`. * **Deprecated. Use StorageClass.mountOptions instead.** `mountOptions`: a comma separated list of [mount options](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options) for every PV of this class to be mounted with. The list is inserted directly into every PV's mount options annotation/field without any validation. Default blank `""`.
Name the `StorageClass` however you like; the name is how claims will request this class. Create the class. Name the `StorageClass` however you like; the name is how claims will request this class. Create the class.
......
...@@ -210,7 +210,8 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis ...@@ -210,7 +210,8 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
if volume.supGroup != 0 { if volume.supGroup != 0 {
annotations[VolumeGidAnnotationKey] = strconv.FormatUint(volume.supGroup, 10) annotations[VolumeGidAnnotationKey] = strconv.FormatUint(volume.supGroup, 10)
} }
if volume.mountOptions != "" { // Only use legacy mount options annotation if StorageClass.MountOptions is empty
if volume.mountOptions != "" && options.MountOptions == nil {
annotations[MountOptionAnnotation] = volume.mountOptions annotations[MountOptionAnnotation] = volume.mountOptions
} }
annotations[annProvisionerID] = string(p.identity) annotations[annProvisionerID] = string(p.identity)
...@@ -234,6 +235,7 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis ...@@ -234,6 +235,7 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
ReadOnly: false, ReadOnly: false,
}, },
}, },
MountOptions: options.MountOptions,
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment