In 4.5, NFS driver pod used 'clientaddr=<pod ip>' as a mount option.
When such pod restarts, it gets a different IP address and volumes mounted
by the old pod are basically broken - all operations (stat, umount) will
just hang forever.
Therefore:
1. Do not use IsLikelyNotMountPoint - it runs stat() on the volume, which
could hang forever. Read /etc/mounts instead.
2. Use "umount -f" to forcefully remove NFS mount.
Carry at least for whole OCP 4.6, where we need to support move from 4.5.
For RWX volume, kubelet does not perform recursive ownership/permission
change. The heuristics that kubelet uses is being modified via -
https://github.com/kubernetes/enhancements/issues/1682
Having said that, for RWX volumes which are made available via NFS
protocol, using fsGroup is not recommended because if there are 2 pods
that are trying to use same volume but with different fsGroup then one
pod may lock out the other pod.
To avoid this, we must be able to set the folder permissions to 777.
This commit adds a cli option --mount-permissions, that allows to
define custom permissions. If the value is not specified, then default
permissions will be kept.
Cherry-picked from: https://github.com/kubernetes-csi/csi-driver-nfs/pull/36