Code Monkey home page Code Monkey logo

csi-nfs's Introduction

CSI plugin for NFS [Build Status]

Description

CSI-NFS is a Container Storage Interface (CSI) plugin that provides network filesystem (NFS) support.

This project may be compiled as a stand-alone binary using Golang that, when run, provides a valid CSI endpoint. This project can also be vendored or built as a Golang plugin in order to extend the functionality of other programs.

Runtime Dependencies

The node portion of the plugin can be run on any Linux node that is able to mount NFS volumes. The Node service verifies this by checking for the existence of /sbin/mount.nfs and /sbin/mount.nfs4 during a NodeProbe.

Installation

CSI-NFS can be installed with Go and the following command:

$ go get github.com/thecodeteam/csi-nfs

The resulting binary will be installed to $GOPATH/bin/csi-nfs.

If you want to build csi-nfs with accurate version information, you'll need to run the go generate command and build again:

$ go get github.com/thecodeteam/csi-nfs
$ cd $GOPATH/src/github.com/thecodeteam/csi-nfs
$ go generate && go install

The binary will once again be installed to $GOPATH/bin/csi-nfs.

Start plugin

Before starting the plugin please set the environment variable CSI_ENDPOINT to a valid Go network address such as csi.sock:

$ CSI_ENDPOINT=csi.sock csi-nfs
INFO[0000] configured com.thecodeteam.csi-nfs            privatedir=/dev/csi-nfs-mounts
INFO[0000] identity service registered
INFO[0000] controller service registered
INFO[0000] node service registered
INFO[0000] serving                                       endpoint="unix:///csi.sock"

The server can be shutdown by using Ctrl-C or sending the process any of the standard exit signals.

Using plugin

The CSI specification uses the gRPC protocol for plug-in communication. The easiest way to interact with a CSI plugin is via the Container Storage Client (csc) program provided via the GoCSI project:

$ go get github.com/thecodeteam/gocsi
$ go install github.com/thecodeteam/gocsi/csc

Then, have csc use the same CSI_ENDPOINT, and you can issue commands to the plugin. Some examples...

Get the plugin's supported versions and plugin info:

$ csc -e csi.sock identity supported-versions
0.1.0
$ csc -e csi.sock -v 0.1.0 identity plugin-info
"com.thecodeteam.csi-nfs"	"0.1.0+9"
"commit"="8b9c33929bc954614f84d687b47dae71891d5514"
"formed"="Tue, 13 Feb 2018 17:37:15 UTC"
"semver"="0.1.0+9"
"url"="https://github.com/thecodeteam/csi-nfs"

Publish an NFS volume to a target path:

$ csc -e csi.sock -v 0.1.0 n publish --cap SINGLE_NODE_WRITER,mount,nfs --target-path /tmp/mnt 192.168.75.2:/data
192.168.75.2:/data

Unpublish NFS volume:

$ csc -e csi.sock -v 0.1.0 n unpublish --target-path /tmp/mnt 192.168.75.2:/data
192.168.75.2:/data

Parameters

No additional parameters are currently supported/required by the plugin

Configuration

The CSI-NFS plugin is built using the GoCSI package. Please see its configuration section for a complete list of the environment variables that may be used to configure this plugin

The following table is a list of this SP's default configuration values:

Name Value
X_CSI_SPEC_REQ_VALIDATION true
X_CSI_SERIAL_VOL_ACCESS true
X_CSI_SUPPORTED_VERSIONS 0.1.0
X_CSI_PRIVATE_MOUNT_DIR /dev/disk/csi-nfs-private

Capable operational modes

The CSI spec defines a set of AccessModes that a volume can have. CSI-NFS supports the following modes for volumes :

// Can only be published once as read/write on a single node,
// at any given time.
SINGLE_NODE_WRITER = 1;

// Can only be published once as readonly on a single node,
// at any given time.
SINGLE_NODE_READER_ONLY = 2;

// Can be published as readonly at multiple nodes simultaneously.
MULTI_NODE_READER_ONLY = 3;

// Can be published at multiple nodes simultaneously. Only one of
// the node can be used as read/write. The rest will be readonly.
MULTI_NODE_SINGLE_WRITER = 4;

// Can be published as read/write at multiple nodes
// simultaneously.
MULTI_NODE_MULTI_WRITER = 5;

The plugin attempts no verification that NFS clients and servers are configured correctly for multi-node writer scenarios (e.g. running rpc.lockd for NFSv3)

Support

For any questions or concerns please file an issue with the csi-nfs project or join the Slack channel #project-rexray at codecommunity.slack.com.

csi-nfs's People

Contributors

akutz avatar codenrhoden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

csi-nfs's Issues

Perform bind-mounts of volumes

Right now the NFS plugin is mounting directly to the requested path. The desired workflow is what is implemented in blockdevices already, which is to mount the volume in a private directory, then to bind-mount the volume to target. It is likely that logic from blockdevices can be re-used.

Specifying security type of mount

It's unclear how to specify a mount option such as sec=sys. When using a NFSv4 volume from a modern operating system, the negotiation will naturally take the highest level of security that is available.

Unfortunately, if that resolves to krb5, an arbitrary container is unlikely to have a ticket or the ability to acquire one. In that case, the contents of the volume will either be inaccessible or mapped to nobody. sec=sys is not ideal, but sufficient in a controlled security context.

Apologies if this is already addressed and I missed it in the documentation.

README.md file is obsolete?

Today I tried to test the csi-nfs as a storage plugin, according to the README.md document, seem below csc command is out of date:

$ csc gets
0.0.0
$ csc getp -version 0.0.0
csi-nfs	0.1.0
$ csc cget -version 0.0.0
LIST_VOLUMES
$ showmount -e 192.168.75.2
Exports list on 192.168.75.2:
	/data                             192.168.75.1
$ mkdir /mnt/test
$ csc mnt -version 0.0.0 -targetPath /mnt/test -mode 1 host=192.168.75.2 export=/data
$ ls -al /mnt/test
total 1
drwxr-xr-x   2 root  wheel    18 Jul 22 20:25 .
drwxrwxrwt  85 root  wheel  2890 Aug 17 15:32 ..
-rw-r--r--   1 root  wheel     0 Jul 22 20:25 test
$ csc umount -version 0.0.0 -targetPath /mnt/test host=192.168.75.2 export=/data
$ ls -al /tmp/mnt
total 0
drwxr-xr-x   2 travis  wheel    68 Aug 16 15:01 .
drwxrwxrwt  85 root    wheel  2890 Aug 17 15:32 ..

The output of the csc in my system is:

# csc
NAME
    csc -- a command line container storage interface (CSI) client

SYNOPSIS
    csc [flags] CMD

AVAILABLE COMMANDS
    controller
    identity
    node

Use "csc -h,--help" for more information

gpkg: A specific commit hash for GoCSI dependency

Hi,

I think it makes sense to update the Gopkg.toml file with a specific commit hash for GoCSI:

[[constraint]]
  branch = "master"
  name = "github.com/codedellemc/gocsi"

I'd switch branch for version (which is recommended by the Gopkg docs) and point to a specific Git ref or tag. Otherwise this is a sliding dependency that will change every time the lock file is updated from the toml file.

Problem mounting under Docker

@clintkitson was kind enough to toss in on rexray/rexray#1114 and once it was clear how to specify options, a lot more made sense.

That said, I think there may be a compatibility issue with the plugin as I built up in rexray/rexray#1114 (comment) over several comments. The mount is happening, but at a directory name that includes a :. Docker seems to be parsing that and dropping the colon and everything after it as it tries to map the external volume.

CIFS support

I am looking for a way to do persistent storage for docker swarm, and understand that Rex-Ray and csi-nfs could be a solution. However, I only have access to a cifs drive.

Would it be possible to extend this driver to support other types of network filesystems as well? I guess it is just a matter of doing a few changes to the code.

does rexray/csi-nfs work with kubernetes?

i was able to create the volume with docker. But now i want to use that volume in a kubernetes cluster.

[root@csi-nfs-node1 docker]# docker volume create -d rexray/csi-nfs -o host=xxxxxx -o export=/data csi-nfs-volume

[root@csi-nfs-node1 docker]# docker volume ls
DRIVER VOLUME NAME
rexray/csi-nfs:latest csi-nfs-volume

I created both a pv and pvc. I notice that kubernetes does not like the driver name rexray/csi-nfs, so i removed rexray.

When i go to launch my nginx pod, it can't mount the volume. Wondering if anyone else tried it.
Thanks..

apiVersion: v1
kind: PersistentVolume
metadata:
creationTimestamp: null
labels:
io.kompose.service: csi-data-volume
name: csi-data-volume
spec:
storageClassName: manual
capacity:
storage: 100Mi
accessModes:

  • ReadWriteOnce
    csi:
    driver: csi-vfs
    volumeHandle: csi-volume

apiVersion: v1
kind: PersistentVolume
metadata:
creationTimestamp: null
labels:
io.kompose.service: csi-data-volume
name: csi-data-volume
spec:
storageClassName: manual
capacity:
storage: 100Mi
accessModes:

  • ReadWriteOnce
    csi:
    driver: csi-vfs
    volumeHandle: csi-nfs-volume

apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:

  • name: nginx
    image: nginx:1.7.9
    ports:
    • containerPort: 80
      volumeMounts:
    • mountPath: "/work"
      name: data-volume
      volumes:
    • name: data-volume
      persistentVolumeClaim:
      claimName: csi-nfs-data-claim
      status: {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.