Skip to content

Commit

Permalink
Update documentation and argument descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
msau42 committed Dec 27, 2018
1 parent 6ac1ed8 commit cb8e500
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 11 deletions.
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,81 @@
[![Build Status](https://travis-ci.org/kubernetes-csi/node-driver-registrar.svg?branch=master)](https://travis-ci.org/kubernetes-csi/node-driver-registrar)
# Node Driver Registrar
Latest stable image: `quay.io/k8scsi/csi-node-driver-registrar:v1.0.1`

A sidecar container that
The node-driver-registrar is a sidecar container that registers the CSI driver using the
[kubelet plugin registration mechanism](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).

## CSI and Kubernetes Compatibility
Min/Max CSI spec: 1.0

Min Kubernetes version: 1.13

For older versions, please refer to the [node-registrar
repository](https://github.com/kubernetes-csi/driver-registrar)

## Usage
There are two UNIX domain sockets used by the node-driver-registrar:

* Socket that registers the driver with kubelet. This socket is created by the
node-driver-registrar at
`/var/lib/kubelet/plugins_registry/<plugin>-reg.sock` on the Kubernetes node.
* Socket that sidecar containers and the kubelet volume subsystem uses to
communicate with the CSI driver and make CSI calls. This socket is created by
CSI driver at `/var/lib/kubelet/plugins/<plugin>/csi.sock`. This is the socket
referenced by the `--csi-address` and `--kubelet-registration-path` arguments.

### Required arguments

* `--csi-address`: This is the path to the CSI driver's socket seen inside the
node-driver-registrar container.
* `--kubelet-registration-path`: This is the path to the CSI driver's socket seen
by kubelet.
* `KUBE_NODE_NAME` environment variable: This is the name of the Kubernetes Node.

### Required permissions
The node-driver-registrar does not interact with the Kubernetes API, so no RBAC
rules are needed.

It does, however, need to be able to mount hostPath volumes and have the file
permissions to:
* read from `/var/lib/kubelet/plugins/<plugin>/`
* write to `/var/lib/kubelet/plugins_registry/`

### Example
Here is an example sidecar spec in the driver DaemonSet. `<plugin>` should be replaced by
the plugin's name.
```
containers:
- name: csi-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.1
args:
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/<plugin>/csi.sock"
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/<plugin> /registration/<plugin>-reg.sock"]
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: plugin-dir
mountPath: /csi
- name: registration-dir
mountPath: /registration
volumes:
- name: registration-dir
hostPath:
path: /var/lib/kubelet/plugins_registry/
type: Directory
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/<plugin>/
type: DirectoryOrCreate
```

1. Registers the containerized CSI driver with kubelet (in the future).

## Community, discussion, contribution, and support

Expand Down
13 changes: 4 additions & 9 deletions cmd/node-driver-registrar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,10 @@ const (
// Command line flags
var (
connectionTimeout = flag.Duration("connection-timeout", 1*time.Minute, "Timeout for waiting for CSI driver socket.")
csiAddress = flag.String("csi-address", "/run/csi/socket", "Address of the CSI driver socket.")
kubeletRegistrationPath = flag.String("kubelet-registration-path", "",
`Enables Kubelet Plugin Registration service, and returns the specified path as "endpoint" in "PluginInfo" response.
If this option is set, the driver-registrar expose a unix domain socket to handle Kubelet Plugin Registration,
this socket MUST be surfaced on the host in the kubelet plugin registration directory (in addition to the CSI driver socket).
If plugin registration is enabled on kubelet (kubelet flag KubeletPluginsWatcher is set), then this option should be set
and the value should be the path of the CSI driver socket on the host machine.`)
showVersion = flag.Bool("version", false, "Show version.")
version = "unknown"
csiAddress = flag.String("csi-address", "/run/csi/socket", "Path of the CSI driver socket that the node-driver-registrar will connect to.")
kubeletRegistrationPath = flag.String("kubelet-registration-path", "", "Path of the CSI driver socket on the Kubernetes host machine.")
showVersion = flag.Bool("version", false, "Show version.")
version = "unknown"

// List of supported versions
supportedVersions = []string{"1.0.0"}
Expand Down

0 comments on commit cb8e500

Please sign in to comment.