chorei&docs: optim Makefile and README

1. add container image build in Makefile
2. reorganized test guide
3. renamed csi-driver yaml.

Signed-off-by: zhouenhua <zhouenhua@bytedance.com>
This commit is contained in:
zhouenhua
2021-11-12 17:29:39 +08:00
parent 847c06d6c6
commit 2792dd2391
5 changed files with 56 additions and 20 deletions

View File

@@ -1,5 +1,30 @@
all:
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
mkdir -p output
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./output/$* ./cmd/nvmfplugin/$*
# Copyright 2021 The Kubernetes Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
CMDS=nvmfplugin
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
all: build
build-%:
mkdir -p output
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./output/$* ./cmd/nvmfplugin/$*.go
container-%: build-%
docker build -t $*:latest -f Dockerfile --label revision=$(REV) .
build: ${CMDS:%=build-%}
container: ${CMDS:%=container-%}
clean:
-rm -rf output/

View File

@@ -22,24 +22,29 @@ $ modprobe nvme-tcp
$ modprobe nvme-rdma
```
## Start NVMf driver
```
$ ./output/nvmfplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode
```
## Test NVMf driver using csc
Get csc tool from https://github.com/rexray/gocsi/tree/master/csc
```
$ go get github.com/rexray/gocsi/csc
```
### Get plugin info
### 1. Complile NVMf driver
```
$ make
```
### 2. Start NVMf driver
```
$ ./output/nvmfplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode
```
### 3.1 Get plugin info
```
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
"csi.nvmf.com" "v1.0.0"
```
### NodePublish a volume
### 3.2 NodePublish a volume
```
$ export TargetTrAddr="NVMf Target Server IP (Ex: 192.168.122.18)"
$ export TargetTrPort="NVMf Target Server Ip Port (Ex: 49153)"
@@ -53,25 +58,31 @@ nvmftestvol
```
You can find a new disk on /mnt/nvmf
### NodeUnpublish a volume
### 3.3 NodeUnpublish a volume
```
$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nvmf nvmftestvol
nvmftestvol
```
## Test NVMf driver in kubernetes cluster
- TODO: because remote disk creation requires a controller.
> TODO: support dynamic provision.
### Installation
### 1. Docker Build image
```
$ make container
```
### 2.1 Load Driver
```
$ kubectl create -f deploy/kubernetes/
```
### Uninstallation
### 2.2 Unload Driver
```
$ kubectl delete -f deploy/kubenetes/
```
### Create Storage Class
### 3.1 Create Storage Class(Dynamic Provisioning)
> NotSupport for controller not ready
- Create
```
$ kubectl create -f examples/kubernetes/example/storageclass.yaml
@@ -81,7 +92,7 @@ $ kubectl create -f examples/kubernetes/example/storageclass.yaml
$ kubectl get sc
```
### Create PV
### 3.2 Create PV(Static Provisioning)
- Create
```
$ kubectl create -f examples/kubernetes/example/pv.yaml
@@ -90,7 +101,7 @@ $ kubectl create -f examples/kubernetes/example/pv.yaml
```
$ kubectl get pv
```
### Mount Volume
### 4. Create Nginx Container
- Create Deployment
```
$ kubectl create -f examples/kubernetes/example/nginx.yaml

View File

@@ -48,7 +48,7 @@ func main() {
flag.Parse()
flag.CommandLine.Parse([]string{})
cmd := &cobra.Command{
Use:"NVMf",
Use: "NVMf",
Short: "CSI based NVMf driver",
Run: func(cmd *cobra.Command, args []string) {
handle()