Code Monkey home page Code Monkey logo

csi-nfs's Introduction

CSI-NFS Build Status

CSI-NFS is a Container Storage Interface (CSI) plug-in 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 plug-in in order to extend the functionality of other programs.

Installation

You'll need a working Go installation. From there, download and installation is as simple as:

go get github.com/thecodeteam/csi-nfs

This will download the source to $GOPATH/src/github.com/thecodeteam/csi-nfs, and will build install the binary csi-nfs to $GOPATH/bin/csi-nfs.

Starting the plugin

In order to execute the binary, you must set the env var CSI_ENDPOINT. CSI is intended to only run over UNIX domain sockets, so a simple way to set this endpoint to a .sock file in the same directory as the project is

export CSI_ENDPOINT=unix://$(go list -f '{{.Dir}}' github.com/thecodeteam/csi-nfs)/csi-nfs.sock

With that in place, you can start the plugin (assuming that $GOPATH/bin is in your $PATH):

$ ./csi-nfs
INFO[0000] .Serve                                        name=csi-nfs

Use ctrl-C to exit.

You can enable debug logging (all logging goes to stdout) by setting the X_CSI_NFS_DEBUG env var. It doesn't matter what value you set it to, just that it is set. For example:

$ X_CSI_NFS_DEBUG= ./csi-nfs
INFO[0000] .Serve                                        name=csi-nfs
DEBU[0000] Added Controller Service
DEBU[0000] Added Node Service
^CINFO[0002] Shutting down server

Configuring the plugin

The behavior of CSI-NFS can be modified with the following environment variables

name purpose default
CSI_ENDPOINT Set path to UNIX domain socket file n/a
X_CSI_NFS_DEBUG enable debug logging to stdout n/a
X_CSI_NFS_NODEONLY Only run the Node Service (no Controller service) n/a
X_CSI_NFS_CONTROLLERONLY Only run the Controller Service (no Node service) n/a

Note that the Identity service is required to always be running, and that the default behavior is to also run both the Controller and the Node service

Using the plugin

All communication with the plugin is done via gRPC. The easiest way to interact with a CSI plugin via CLI is to use the csc tool found in GoCSI.

You can install this tool with:

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

With $GOPATH/bin in your $PATH, you can issue commands using the csc command. You will want to use a separate shell from where you are running the csi-nfs binary, and as such you will once again need to do:

export CSI_ENDPOINT=unix://$(go list -f '{{.Dir}}' github.com/thecodeteam/csi-nfs)/csi-nfs.sock

Here are some sample commands:

$ 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 ..

csi-nfs's People

Contributors

akutz avatar codenrhoden avatar

Watchers

 avatar  avatar  avatar

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.