Skip to content

Latest commit

 

History

History
105 lines (86 loc) · 3.34 KB

csi-dev.md

File metadata and controls

105 lines (86 loc) · 3.34 KB

SMB CSI driver development guide

How to build this project

  • Clone repo
$ mkdir -p $GOPATH/src/github.com/kubernetes-csi
$ git clone https://github.com/kubernetes-csi/csi-driver-smb $GOPATH/src/github.com/kubernetes-csi/csi-driver-smb
  • Build CSI driver
$ cd $GOPATH/src/github.com/kubernetes-csi/csi-driver-smb
$ make
  • Run verification test before submitting code
$ make verify
  • If there is config file changed under charts directory, run following command to update chart file
helm package charts/latest/csi-driver-smb -d charts/latest/

How to test CSI driver in local environment

Install csc tool according to https://github.com/rexray/gocsi/tree/master/csc

$ mkdir -p $GOPATH/src/github.com
$ cd $GOPATH/src/github.com
$ git clone https://github.com/rexray/gocsi.git
$ cd rexray/gocsi/csc
$ make build

Start CSI driver locally

$ cd $GOPATH/src/github.com/kubernetes-csi/csi-driver-smb
$ ./_output/amd64/smbplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 &

1. Get plugin info

$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
"smb.csi.k8s.io"    "v0.1.0"

2. Stage a SMB volume on a node

$ csc node stage --endpoint tcp://127.0.0.1:10000 --cap 1,block --staging-target-path=/tmp/staging-path --with-requires-attribs ... --with-requires-creds ...

3. Publish a SMB volume on a node (bind mount the volume from staging to target path)

$ csc node publish --endpoint tcp://127.0.0.1:10000 --cap 1,block --staging-target-path=/tmp/staging-path --target-path=/tmp/publish-path volumeid

4. Unpublish a SMB volume on a node

$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path=/tmp/publish-path volumeid

5. Unstage a SMB volume on a node

$ csc node unstage --endpoint tcp://127.0.0.1:10000 --staging-target-path=/tmp/staging-path volumeid

6. Validate volume capabilities

$ csc controller validate-volume-capabilities --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeID
CSIVolumeID  true

7. Get NodeID

$ csc node get-info --endpoint tcp://127.0.0.1:10000
CSINode

How to test CSI driver in a Kubernetes cluster

  • Build container image and push image to dockerhub
# run `docker login` first
export REGISTRY=<dockerhub-alias>
export IMAGE_VERSION=latest
# build linux, windows images
make container-all
# create a manifest list for the images above
make push-manifest
wget -O csi-smb-node.yaml https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/deploy/csi-smb-node.yaml
# edit csi-smb-node.yaml
kubectl apply -f csi-smb-node.yaml

How to update chart index

helm repo index charts --url=https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts