nfs: add nodeserver within cephcsi

This commit adds nfs nodeserver capable of
mounting nfs volumes, even with pod networking
using NSenter design similar to rbd and cephfs.
NodePublish, NodeUnpublish, NodeGetVolumeStats
and NodeGetCapabilities have been implemented.

The nodeserver implementation has been inspired
from https://github.com/kubernetes-csi/csi-driver-nfs,
which was previously used for mounted cephcsi exported
nfs volumes. The current implementation is also
backward compatible for the previously created
PVCs.

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2022-07-26 15:34:57 +05:30
committed by mergify[bot]
parent c2280011d1
commit 3d3c029471
6 changed files with 576 additions and 15 deletions

View File

@ -59,6 +59,11 @@ type ClusterInfo struct {
// RadosNamespace is a rados namespace in the pool
RadosNamespace string `json:"radosNamespace"`
} `json:"rbd"`
// NFS contains NFS specific options
NFS struct {
// symlink filepath for the network namespace where we need to execute commands.
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
} `json:"nfs"`
}
// Expected JSON structure in the passed in config file is,
@ -194,3 +199,13 @@ func GetCephFSNetNamespaceFilePath(pathToConfig, clusterID string) (string, erro
return cluster.CephFS.NetNamespaceFilePath, nil
}
// GetNFSNetNamespaceFilePath returns the netNamespaceFilePath for NFS volumes.
func GetNFSNetNamespaceFilePath(pathToConfig, clusterID string) (string, error) {
cluster, err := readClusterInfo(pathToConfig, clusterID)
if err != nil {
return "", err
}
return cluster.NFS.NetNamespaceFilePath, nil
}