diff --git a/.gitignore b/.gitignore index 07cbee8..fa8cd07 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ nohup.out coverage.txt profile.out .DS_Store +buildscripts/provisioner-nfs/provisioner-nfs diff --git a/pkg/kubernetes/api/core/v1/persistentvolume/build.go b/pkg/kubernetes/api/core/v1/persistentvolume/build.go index d649a2c..fb7e93f 100644 --- a/pkg/kubernetes/api/core/v1/persistentvolume/build.go +++ b/pkg/kubernetes/api/core/v1/persistentvolume/build.go @@ -188,6 +188,15 @@ func (b *Builder) WithNFS(server, path string, readOnly bool) *Builder { return b } +// WithMountOptions sets the MountOptions field in PV with provided arguments +func (b *Builder) WithMountOptions(mountOptions []string) *Builder { + if len(mountOptions) == 0 { + return b + } + b.pv.object.Spec.MountOptions = mountOptions + return b +} + // Build returns the PV API instance func (b *Builder) Build() (*corev1.PersistentVolume, error) { if len(b.errs) > 0 { diff --git a/provisioner/helper_kernel_nfs_server.go b/provisioner/helper_kernel_nfs_server.go index e8afda0..60e8787 100644 --- a/provisioner/helper_kernel_nfs_server.go +++ b/provisioner/helper_kernel_nfs_server.go @@ -36,6 +36,12 @@ const ( // NFSPVFinalizer represents finalizer string used by NFSPV NFSPVFinalizer = "nfs.openebs.io/finalizer" + + //NFS Server Port + NFSServerPort = 2049 + + //RPC Bind Port + RPCBindPort = 111 ) var ( @@ -210,7 +216,11 @@ func (p *Provisioner) createDeployment(nfsServerOpts *KernelNFSServerOptions) er []corev1.ContainerPort{ corev1.ContainerPort{ Name: "nfs", - ContainerPort: 2049, + ContainerPort: NFSServerPort, + }, + corev1.ContainerPort{ + Name: "rpcbind", + ContainerPort: RPCBindPort, }, }, ). @@ -327,7 +337,11 @@ func (p *Provisioner) createService(nfsServerOpts *KernelNFSServerOptions) error []corev1.ServicePort{ corev1.ServicePort{ Name: "nfs", - Port: 2049, + Port: NFSServerPort, + }, + corev1.ServicePort{ + Name: "rpcbind", + Port: RPCBindPort, }, }, ). diff --git a/provisioner/provisioner_kernel_nfs_server.go b/provisioner/provisioner_kernel_nfs_server.go index 66b0c7d..adae8b3 100644 --- a/provisioner/provisioner_kernel_nfs_server.go +++ b/provisioner/provisioner_kernel_nfs_server.go @@ -78,6 +78,7 @@ func (p *Provisioner) ProvisionKernalNFSServer(opts pvController.ProvisionOption WithReclaimPolicy(*opts.StorageClass.ReclaimPolicy). WithAccessModes(pvc.Spec.AccessModes). WithCapacityQty(pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]). + WithMountOptions(opts.StorageClass.MountOptions). WithNFS(nfsService, "/", false) //Build the pvObject