Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#1027 from wongma7/nfs-mount-opt…
Browse files Browse the repository at this point in the history
…ions

Override mountOptions parameter with sc.mountOptions
  • Loading branch information
k8s-ci-robot authored Oct 16, 2018
2 parents 1ad6280 + a75f92a commit 04cec48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nfs/deploy/kubernetes/class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion nfs/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 3 additions & 1 deletion nfs/pkg/volume/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -234,6 +235,7 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
ReadOnly: false,
},
},
MountOptions: options.MountOptions,
},
}

Expand Down

0 comments on commit 04cec48

Please sign in to comment.