diff --git a/nfs/deploy/kubernetes/class.yaml b/nfs/deploy/kubernetes/class.yaml index 6ea74350d23bacbd0e6b9f3447283f134c9b0eea..582d0f1c62af12494b9206fcf7cf49c11e50ea12 100644 --- a/nfs/deploy/kubernetes/class.yaml +++ b/nfs/deploy/kubernetes/class.yaml @@ -3,5 +3,5 @@ apiVersion: storage.k8s.io/v1 metadata: name: example-nfs provisioner: example.com/nfs -parameters: - mountOptions: "vers=4.1" # TODO: reconcile with StorageClass.mountOptions +mountOptions: + - vers=4.1 diff --git a/nfs/docs/usage.md b/nfs/docs/usage.md index 4c50116f90daa9ff4f4c359d35e90847cdec88e9..33a4f910e31eeafe2a16530370538ca6028ad298 100644 --- a/nfs/docs/usage.md +++ b/nfs/docs/usage.md @@ -7,7 +7,7 @@ Edit the `provisioner` field in `deploy/kubernetes/class.yaml` to be the provisi ### 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"`. * `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. diff --git a/nfs/pkg/volume/provision.go b/nfs/pkg/volume/provision.go index ad4253340662bb6838ba73baca14d8d5a5435fec..26fef265c39bf33e5f09f8bfb8c1d61fe2feae13 100644 --- a/nfs/pkg/volume/provision.go +++ b/nfs/pkg/volume/provision.go @@ -210,7 +210,8 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis if volume.supGroup != 0 { 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[annProvisionerID] = string(p.identity) @@ -234,6 +235,7 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis ReadOnly: false, }, }, + MountOptions: options.MountOptions, }, }