From f481dddf44391425ccef6e263f4b33a381d4d1d0 Mon Sep 17 00:00:00 2001 From: Chakravarthy Nelluri Date: Mon, 4 Dec 2017 15:01:40 -0700 Subject: [PATCH 01/15] Refactor to app & pkg directories --- app/nfsplugin/main.go | 59 ++++++++++++++++++++++++ pkg/nfs/README.md | 44 ++++++++++++++++++ pkg/nfs/driver.go | 74 +++++++++++++++++++++++++++++++ pkg/nfs/nodeserver.go | 101 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 app/nfsplugin/main.go create mode 100644 pkg/nfs/README.md create mode 100644 pkg/nfs/driver.go create mode 100644 pkg/nfs/nodeserver.go diff --git a/app/nfsplugin/main.go b/app/nfsplugin/main.go new file mode 100644 index 00000000..e2af08d8 --- /dev/null +++ b/app/nfsplugin/main.go @@ -0,0 +1,59 @@ +/* +Copyright 2017 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. +*/ + +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" + + "github.com/kubernetes-csi/drivers/pkg/nfs" +) + +var ( + endpoint string + nodeID string +) + +func main() { + cmd := &cobra.Command{ + Use: "NFS", + Short: "CSI based NFS driver", + Run: func(cmd *cobra.Command, args []string) { + handle() + }, + } + + cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id") + cmd.MarkPersistentFlagRequired("nodeid") + + cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint") + cmd.MarkPersistentFlagRequired("endpoint") + + if err := cmd.Execute(); err != nil { + fmt.Fprintf(os.Stderr, "%s", err.Error()) + os.Exit(1) + } + + os.Exit(0) +} + +func handle() { + d := nfs.NewDriver(nodeID, endpoint) + d.Run() +} diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md new file mode 100644 index 00000000..1b878a7a --- /dev/null +++ b/pkg/nfs/README.md @@ -0,0 +1,44 @@ +# CSI NFS driver + +## Usage: + +### Start NFS driver +``` +$ sudo ../_output/nfsdriver --endpoint tcp://127.0.0.1:10000 --nodeid CSINode +``` + +### Test using csc +Get ```csc``` tool from https://github.com/chakri-nelluri/gocsi/tree/master/csc + +#### Get plugin info +``` +$ csc identity plugininfo --endpoint tcp://127.0.0.1:10000 +"NFS" "0.1.0" +``` + +### Get supported versions +``` +$ csc identity supportedversions --endpoint tcp://127.0.0.1:10000 +0.1.0 +``` + +#### NodePublish a volume +``` +$ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" +$ export NFS_SHARE="Your NFS share" +$ csc node publishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib exportPath=$NFS_SHARE nfstestvol +nfstestvol +``` + +#### NodeUnpublish a volume +``` +$ csc node unpublishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol +nfstestvol +``` + +#### Get NodeID +``` +$ csc node getid --endpoint tcp://127.0.0.1:10000 +CSINode +``` + diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go new file mode 100644 index 00000000..b31eff35 --- /dev/null +++ b/pkg/nfs/driver.go @@ -0,0 +1,74 @@ +/* +Copyright 2017 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. +*/ + +package nfs + +import ( + "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/golang/glog" + + "github.com/kubernetes-csi/drivers/pkg/csi-common" +) + +type driver struct { + csiDriver *csicommon.CSIDriver + endpoint string + + ids *csicommon.DefaultIdentityServer + ns *nodeServer + + cap []*csi.VolumeCapability_AccessMode + cscap []*csi.ControllerServiceCapability +} + +const ( + driverName = "NFS" +) + +var ( + version = csi.Version{ + Minor: 1, + } +) + +func GetSupportedVersions() []*csi.Version { + return []*csi.Version{&version} +} + +func NewDriver(nodeID, endpoint string) *driver { + glog.Infof("Driver: %v version: %v", driverName, csicommon.GetVersionString(&version)) + + d := &driver{} + + d.endpoint = endpoint + + csiDriver := csicommon.NewCSIDriver(driverName, &version, GetSupportedVersions(), nodeID) + csiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER}) + + d.csiDriver = csiDriver + + return d +} + +func NewNodeServer(d *driver) *nodeServer { + return &nodeServer{ + DefaultNodeServer: csicommon.NewDefaultNodeServer(d.csiDriver), + } +} + +func (d *driver) Run() { + csicommon.RunNodePublishServer(d.endpoint, d.csiDriver, NewNodeServer(d)) +} diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go new file mode 100644 index 00000000..a2398662 --- /dev/null +++ b/pkg/nfs/nodeserver.go @@ -0,0 +1,101 @@ +/* +Copyright 2017 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. +*/ + +package nfs + +import ( + "fmt" + "os" + "strings" + + "github.com/container-storage-interface/spec/lib/go/csi" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "k8s.io/kubernetes/pkg/util/mount" + "k8s.io/kubernetes/pkg/volume/util" + + "github.com/kubernetes-csi/drivers/pkg/csi-common" +) + +type nodeServer struct { + *csicommon.DefaultNodeServer +} + +func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { + targetPath := req.GetTargetPath() + notMnt, err := mount.New("").IsLikelyNotMountPoint(targetPath) + if err != nil { + if os.IsNotExist(err) { + if err := os.MkdirAll(targetPath, 0750); err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + notMnt = true + } else { + return nil, status.Error(codes.Internal, err.Error()) + } + } + + if !notMnt { + return &csi.NodePublishVolumeResponse{}, nil + } + + mo := req.GetVolumeCapability().GetMount().GetMountFlags() + if req.GetReadonly() { + mo = append(mo, "ro") + } + + s := req.GetVolumeAttributes()["server"] + ep := req.GetVolumeAttributes()["exportPath"] + source := fmt.Sprintf("%s:%s", s, ep) + + mounter := mount.New("") + err = mounter.Mount(source, targetPath, "nfs", mo) + if err != nil { + if os.IsPermission(err) { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + if strings.Contains(err.Error(), "invalid argument") { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + return nil, status.Error(codes.Internal, err.Error()) + } + + return &csi.NodePublishVolumeResponse{}, nil +} + +func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { + targetPath := req.GetTargetPath() + notMnt, err := mount.New("").IsLikelyNotMountPoint(targetPath) + + if err != nil { + if os.IsNotExist(err) { + return nil, status.Error(codes.NotFound, "Targetpath not found") + } else { + return nil, status.Error(codes.Internal, err.Error()) + } + } + if notMnt { + return nil, status.Error(codes.NotFound, "Volume not mounted") + } + + err = util.UnmountPath(req.GetTargetPath(), mount.New("")) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &csi.NodeUnpublishVolumeResponse{}, nil +} From eb5623b80731f371b17d8c55b6fb1dfc053f42c7 Mon Sep 17 00:00:00 2001 From: Chakravarthy Nelluri Date: Mon, 11 Dec 2017 05:01:12 +0000 Subject: [PATCH 02/15] Add NFS deployment files --- pkg/nfs/README.md | 32 ++++++++- .../kubernetes/csi-attacher-nfsplugin.yaml | 64 ++++++++++++++++++ .../deploy/kubernetes/csi-attacher-rbac.yaml | 37 +++++++++++ .../kubernetes/csi-nodeplugin-nfsplugin.yaml | 66 +++++++++++++++++++ .../kubernetes/csi-nodeplugin-rbac.yaml | 34 ++++++++++ pkg/nfs/dockerfile/Dockerfile | 8 +++ pkg/nfs/driver.go | 7 +- pkg/nfs/examples/kubernetes/nginx.yaml | 52 +++++++++++++++ 8 files changed, 295 insertions(+), 5 deletions(-) create mode 100644 pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml create mode 100644 pkg/nfs/deploy/kubernetes/csi-attacher-rbac.yaml create mode 100644 pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml create mode 100644 pkg/nfs/deploy/kubernetes/csi-nodeplugin-rbac.yaml create mode 100644 pkg/nfs/dockerfile/Dockerfile create mode 100644 pkg/nfs/examples/kubernetes/nginx.yaml diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md index 1b878a7a..06e284c3 100644 --- a/pkg/nfs/README.md +++ b/pkg/nfs/README.md @@ -1,14 +1,40 @@ # CSI NFS driver -## Usage: + +## Kubernetes +### Requirements + +The folllowing feature gates and runtime config have to be enabled to deploy the driver + +``` +FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true +RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" +``` + +Mountprogpation requries support for privileged containers. So, make sure privileged containers are enabled in the cluster. + +### Example local-up-cluster.sh + +```ALLOW_PRIVILEGED=true FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh``` + +### Deploy + +```kubectl -f deploy/kubernetes create``` + +### Example Nginx application +Please update the NFS Server & share information in nginx.yaml file. + +```kubectl -f examples/kubernetes/nginx.yaml create``` + +## Using CSC tool ### Start NFS driver ``` $ sudo ../_output/nfsdriver --endpoint tcp://127.0.0.1:10000 --nodeid CSINode ``` -### Test using csc -Get ```csc``` tool from https://github.com/chakri-nelluri/gocsi/tree/master/csc +## Test +Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc #### Get plugin info ``` diff --git a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml new file mode 100644 index 00000000..28fd5ddb --- /dev/null +++ b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -0,0 +1,64 @@ +# This YAML file contains attacher & csi driver API objects that are necessary +# to run external CSI attacher for nfs + +kind: Service +apiVersion: v1 +metadata: + name: csi-attacher-nfsplugin + labels: + app: csi-attacher-nfsplugin +spec: + selector: + app: csi-attacher-nfsplugin + ports: + - name: dummy + port: 12345 + +--- +kind: StatefulSet +apiVersion: apps/v1beta1 +metadata: + name: csi-attacher-nfsplugin +spec: + serviceName: "csi-attacher" + replicas: 1 + template: + metadata: + labels: + app: csi-attacher-nfsplugin + spec: + serviceAccount: csi-attacher + containers: + - name: csi-attacher + image: docker.io/k8scsi/csi-attacher + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + env: + - name: ADDRESS + value: /var/lib/csi/sockets/pluginproxy/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/sockets/pluginproxy/ + + - name: nfs + image: docker.io/k8s/nfsplugin:v0.1 + args : + - "--nodeid=$(NODE_ID)" + - "--endpoint=$(CSI_ENDPOINT)" + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix://plugin/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /plugin + volumes: + - name: socket-dir + emptyDir: + diff --git a/pkg/nfs/deploy/kubernetes/csi-attacher-rbac.yaml b/pkg/nfs/deploy/kubernetes/csi-attacher-rbac.yaml new file mode 100644 index 00000000..975fdd67 --- /dev/null +++ b/pkg/nfs/deploy/kubernetes/csi-attacher-rbac.yaml @@ -0,0 +1,37 @@ +# This YAML file contains RBAC API objects that are necessary to run external +# CSI attacher for nfs flex adapter + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-attacher + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: external-attacher-runner +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-attacher-role +subjects: + - kind: ServiceAccount + name: csi-attacher + namespace: default +roleRef: + kind: ClusterRole + name: external-attacher-runner + apiGroup: rbac.authorization.k8s.io diff --git a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml new file mode 100644 index 00000000..816212b4 --- /dev/null +++ b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -0,0 +1,66 @@ +# This YAML file contains driver-registrar & csi driver nodeplugin API objects +# that are necessary to run CSI nodeplugin for nfs +kind: DaemonSet +apiVersion: apps/v1beta2 +metadata: + name: csi-nodeplugin-nfsplugin +spec: + selector: + matchLabels: + app: csi-nodeplugin-nfsplugin + template: + metadata: + labels: + app: csi-nodeplugin-nfsplugin + spec: + serviceAccount: csi-nodeplugin + hostNetwork: true + containers: + - name: driver-registrar + image: docker.io/k8scsi/driver-registrar + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + env: + - name: ADDRESS + value: /plugin/csi.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: plugin-dir + mountPath: /plugin + - name: nfs + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + image: docker.io/k8s/nfsplugin:v0.1 + args : + - "--nodeid=$(NODE_ID)" + - "--endpoint=$(CSI_ENDPOINT)" + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix://plugin/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: plugin-dir + mountPath: /plugin + - name: pods-mount-dir + mountPath: /var/lib/kubelet/pods + mountPropagation: "Bidirectional" + volumes: + - name: plugin-dir + hostPath: + path: /var/lib/kubelet/plugins/csi-nfsplugin + type: DirectoryOrCreate + - name: pods-mount-dir + hostPath: + path: /var/lib/kubelet/pods + type: Directory diff --git a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-rbac.yaml b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-rbac.yaml new file mode 100644 index 00000000..530e067b --- /dev/null +++ b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-rbac.yaml @@ -0,0 +1,34 @@ +# This YAML defines all API objects to create RBAC roles for CSI node plugin +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-nodeplugin + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin +subjects: + - kind: ServiceAccount + name: csi-nodeplugin + namespace: default +roleRef: + kind: ClusterRole + name: csi-nodeplugin + apiGroup: rbac.authorization.k8s.io diff --git a/pkg/nfs/dockerfile/Dockerfile b/pkg/nfs/dockerfile/Dockerfile new file mode 100644 index 00000000..8306ca37 --- /dev/null +++ b/pkg/nfs/dockerfile/Dockerfile @@ -0,0 +1,8 @@ +FROM centos:7.4.1708 + +# Copy nfsplugin from build _output directory +COPY nfsplugin /nfsplugin + +RUN yum -y install nfs-utils && yum -y install epel-release && yum -y install jq && yum clean all + +ENTRYPOINT ["/nfsplugin"] diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index b31eff35..634d9b90 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -35,7 +35,7 @@ type driver struct { } const ( - driverName = "NFS" + driverName = "csi-nfsplugin" ) var ( @@ -70,5 +70,8 @@ func NewNodeServer(d *driver) *nodeServer { } func (d *driver) Run() { - csicommon.RunNodePublishServer(d.endpoint, d.csiDriver, NewNodeServer(d)) + csicommon.Serve(d.endpoint, + csicommon.NewDefaultIdentityServer(d.csiDriver), + csicommon.NewDefaultControllerServer(d.csiDriver), + NewNodeServer(d)) } diff --git a/pkg/nfs/examples/kubernetes/nginx.yaml b/pkg/nfs/examples/kubernetes/nginx.yaml new file mode 100644 index 00000000..b1173b32 --- /dev/null +++ b/pkg/nfs/examples/kubernetes/nginx.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: data-nfsplugin + labels: + name: data-nfsplugin + annotations: + csi.volume.kubernetes.io/volume-attributes: '{"server": "10.10.10.10", "share": "share"}' +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: 100Gi + csi: + driver: csi-nfsplugin + volumeHandle: data-id +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: data-nfsplugin +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + selector: + matchExpressions: + - key: name + operator: In + values: ["data-nfsplugin"] +--- +apiVersion: v1 +kind: Pod +metadata: + name: nginx +spec: + containers: + - image: maersk/nginx + imagePullPolicy: Always + name: nginx + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - mountPath: /var/www + name: data-nfsplugin + volumes: + - name: data-nfsplugin + persistentVolumeClaim: + claimName: data-nfsplugin From 8b144029559ca8d0bd5653868694df46fa8545f9 Mon Sep 17 00:00:00 2001 From: Chakravarthy Nelluri Date: Wed, 13 Dec 2017 01:12:06 -0500 Subject: [PATCH 03/15] Add some unit tests & improve logging --- app/nfsplugin/main.go | 11 +++++++++++ pkg/nfs/README.md | 4 ++-- pkg/nfs/driver.go | 8 +++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/nfsplugin/main.go b/app/nfsplugin/main.go index e2af08d8..6b68e9a0 100644 --- a/app/nfsplugin/main.go +++ b/app/nfsplugin/main.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "flag" "fmt" "os" @@ -30,7 +31,14 @@ var ( nodeID string ) +func init() { + flag.Set("logtostderr", "true") +} + func main() { + + flag.CommandLine.Parse([]string{}) + cmd := &cobra.Command{ Use: "NFS", Short: "CSI based NFS driver", @@ -39,12 +47,15 @@ func main() { }, } + cmd.Flags().AddGoFlagSet(flag.CommandLine) + cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id") cmd.MarkPersistentFlagRequired("nodeid") cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint") cmd.MarkPersistentFlagRequired("endpoint") + cmd.ParseFlags(os.Args[1:]) if err := cmd.Execute(); err != nil { fmt.Fprintf(os.Stderr, "%s", err.Error()) os.Exit(1) diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md index 06e284c3..bb90b9dd 100644 --- a/pkg/nfs/README.md +++ b/pkg/nfs/README.md @@ -30,7 +30,7 @@ Please update the NFS Server & share information in nginx.yaml file. ### Start NFS driver ``` -$ sudo ../_output/nfsdriver --endpoint tcp://127.0.0.1:10000 --nodeid CSINode +$ sudo ../../_output/flexadapter --endpoint tcp://127.0.0.1:10000 --drivername simplenfs --driverpath ./examples/simplenfs-flexdriver/driver/nfs --nodeid CSINode -v=3 ``` ## Test @@ -52,7 +52,7 @@ $ csc identity supportedversions --endpoint tcp://127.0.0.1:10000 ``` $ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" $ export NFS_SHARE="Your NFS share" -$ csc node publishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib exportPath=$NFS_SHARE nfstestvol +$ csc node publishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib share=$NFS_SHARE nfstestvol nfstestvol ``` diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index 634d9b90..94408f48 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -70,8 +70,10 @@ func NewNodeServer(d *driver) *nodeServer { } func (d *driver) Run() { - csicommon.Serve(d.endpoint, + s := csicommon.NewNonBlockingGRPCServer() + s.Start(d.endpoint, csicommon.NewDefaultIdentityServer(d.csiDriver), - csicommon.NewDefaultControllerServer(d.csiDriver), - NewNodeServer(d)) + csicommon.NewDefaultControllerServer(d.csiDriver), + NewNodeServer(d)) + s.Wait() } From ab44838726e5ea48f9c090a7ac5810756a49d6ce Mon Sep 17 00:00:00 2001 From: Chakravarthy Nelluri Date: Wed, 10 Jan 2018 15:09:06 -0500 Subject: [PATCH 04/15] Fix Readmes --- pkg/nfs/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md index bb90b9dd..da5bea6d 100644 --- a/pkg/nfs/README.md +++ b/pkg/nfs/README.md @@ -30,7 +30,7 @@ Please update the NFS Server & share information in nginx.yaml file. ### Start NFS driver ``` -$ sudo ../../_output/flexadapter --endpoint tcp://127.0.0.1:10000 --drivername simplenfs --driverpath ./examples/simplenfs-flexdriver/driver/nfs --nodeid CSINode -v=3 +$ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 ``` ## Test @@ -38,13 +38,13 @@ Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc #### Get plugin info ``` -$ csc identity plugininfo --endpoint tcp://127.0.0.1:10000 +$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000 "NFS" "0.1.0" ``` ### Get supported versions ``` -$ csc identity supportedversions --endpoint tcp://127.0.0.1:10000 +$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000 0.1.0 ``` @@ -52,19 +52,19 @@ $ csc identity supportedversions --endpoint tcp://127.0.0.1:10000 ``` $ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" $ export NFS_SHARE="Your NFS share" -$ csc node publishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib share=$NFS_SHARE nfstestvol +$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib share=$NFS_SHARE nfstestvol nfstestvol ``` #### NodeUnpublish a volume ``` -$ csc node unpublishvolume --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol +$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol nfstestvol ``` #### Get NodeID ``` -$ csc node getid --endpoint tcp://127.0.0.1:10000 +$ csc node get-id --endpoint tcp://127.0.0.1:10000 CSINode ``` From 650cb5b1f50a12ddd317de594e04af701e50f422 Mon Sep 17 00:00:00 2001 From: Humble Devassy Chirammal Date: Mon, 15 Jan 2018 20:28:19 +0530 Subject: [PATCH 05/15] NFS driver: Change attribute on NodePublish() to reflect the examples. --- pkg/nfs/nodeserver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go index a2398662..635b7bfc 100644 --- a/pkg/nfs/nodeserver.go +++ b/pkg/nfs/nodeserver.go @@ -59,7 +59,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis } s := req.GetVolumeAttributes()["server"] - ep := req.GetVolumeAttributes()["exportPath"] + ep := req.GetVolumeAttributes()["share"] source := fmt.Sprintf("%s:%s", s, ep) mounter := mount.New("") From 715b1ff4ea2deb51a8af447f61978e00c3164f75 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Mon, 15 Jan 2018 22:49:26 +0530 Subject: [PATCH 06/15] Correct NFS driver deployment artifacts. Signed-off-by: Humble Chirammal --- pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml | 2 +- pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml index 28fd5ddb..3f372c54 100644 --- a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -43,7 +43,7 @@ spec: mountPath: /var/lib/csi/sockets/pluginproxy/ - name: nfs - image: docker.io/k8s/nfsplugin:v0.1 + image: docker.io/k8scsi/nfsplugin:v0.1 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" diff --git a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml index 816212b4..030b5e2b 100644 --- a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -37,7 +37,7 @@ spec: capabilities: add: ["SYS_ADMIN"] allowPrivilegeEscalation: true - image: docker.io/k8s/nfsplugin:v0.1 + image: docker.io/k8scsi/nfsplugin:v0.1 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" From 04e38ab5b56c39a35a9f943abaa75e84d5e8caae Mon Sep 17 00:00:00 2001 From: Guangya Liu Date: Wed, 7 Feb 2018 21:14:26 +0800 Subject: [PATCH 07/15] Added CSI nfsplugin build process. --- pkg/nfs/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md index da5bea6d..bcf8bb6c 100644 --- a/pkg/nfs/README.md +++ b/pkg/nfs/README.md @@ -28,6 +28,11 @@ Please update the NFS Server & share information in nginx.yaml file. ## Using CSC tool +### Build nfsplugin +``` +$ make nfs +``` + ### Start NFS driver ``` $ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 From aa9ec2da56bd47166c42de06af087d4932311652 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Wed, 28 Feb 2018 20:13:28 -0500 Subject: [PATCH 08/15] refactor csi-common and hostpath plugin for CSI 0.2.0 spec --- pkg/nfs/driver.go | 14 ++++---------- pkg/nfs/nodeserver.go | 10 +++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index 94408f48..fbf4c9c8 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -17,7 +17,7 @@ limitations under the License. package nfs import ( - "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/container-storage-interface/spec/lib/go/csi/v0" "github.com/golang/glog" "github.com/kubernetes-csi/drivers/pkg/csi-common" @@ -39,23 +39,17 @@ const ( ) var ( - version = csi.Version{ - Minor: 1, - } + version = "0.2.0" ) -func GetSupportedVersions() []*csi.Version { - return []*csi.Version{&version} -} - func NewDriver(nodeID, endpoint string) *driver { - glog.Infof("Driver: %v version: %v", driverName, csicommon.GetVersionString(&version)) + glog.Infof("Driver: %v version: %v", driverName, version) d := &driver{} d.endpoint = endpoint - csiDriver := csicommon.NewCSIDriver(driverName, &version, GetSupportedVersions(), nodeID) + csiDriver := csicommon.NewCSIDriver(driverName, version, nodeID) csiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER}) d.csiDriver = csiDriver diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go index 635b7bfc..ba784ce3 100644 --- a/pkg/nfs/nodeserver.go +++ b/pkg/nfs/nodeserver.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/container-storage-interface/spec/lib/go/csi/v0" "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -99,3 +99,11 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu return &csi.NodeUnpublishVolumeResponse{}, nil } + +func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { + return &csi.NodeUnstageVolumeResponse{}, nil +} + +func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { + return &csi.NodeStageVolumeResponse{}, nil +} From beedbb17e153af670557a5166fd71a83aa73e25a Mon Sep 17 00:00:00 2001 From: xing-yang Date: Wed, 7 Mar 2018 11:31:56 -0800 Subject: [PATCH 09/15] Update CSI Plugins README This patch updates the README for plugins for CSI 0.2.0. It includes the following changes: - Updates the CSC tool location - Removes "get supported versions" because that was removed from CSI. --- pkg/nfs/README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md index bcf8bb6c..744eb270 100644 --- a/pkg/nfs/README.md +++ b/pkg/nfs/README.md @@ -39,7 +39,7 @@ $ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v= ``` ## Test -Get ```csc``` tool from https://github.com/thecodeteam/gocsi/tree/master/csc +Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc #### Get plugin info ``` @@ -47,12 +47,6 @@ $ csc identity plugin-info --endpoint tcp://127.0.0.1:10000 "NFS" "0.1.0" ``` -### Get supported versions -``` -$ csc identity supported-versions --endpoint tcp://127.0.0.1:10000 -0.1.0 -``` - #### NodePublish a volume ``` $ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" From d600d0bb20e156e23d067b86b402d34b979b15fe Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Mon, 12 Mar 2018 18:31:20 +0000 Subject: [PATCH 10/15] csi 0.2.0: update nfs CSI PV example Signed-off-by: Huamin Chen --- pkg/nfs/examples/kubernetes/nginx.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/nfs/examples/kubernetes/nginx.yaml b/pkg/nfs/examples/kubernetes/nginx.yaml index b1173b32..8048e9cd 100644 --- a/pkg/nfs/examples/kubernetes/nginx.yaml +++ b/pkg/nfs/examples/kubernetes/nginx.yaml @@ -4,16 +4,17 @@ metadata: name: data-nfsplugin labels: name: data-nfsplugin - annotations: - csi.volume.kubernetes.io/volume-attributes: '{"server": "10.10.10.10", "share": "share"}' spec: accessModes: - - ReadWriteOnce + - ReadWriteMany capacity: storage: 100Gi csi: driver: csi-nfsplugin volumeHandle: data-id + volumeAttributes: + server: 127.0.0.1 + share: /export --- apiVersion: v1 kind: PersistentVolumeClaim @@ -21,7 +22,7 @@ metadata: name: data-nfsplugin spec: accessModes: - - ReadWriteOnce + - ReadWriteMany resources: requests: storage: 100Gi From 93dada2f8a20630d251d3e51782675ae29cd8b67 Mon Sep 17 00:00:00 2001 From: xing-yang Date: Tue, 13 Mar 2018 12:25:55 -0700 Subject: [PATCH 11/15] NFS plugin does not support ControllerServiceCapability Since NFS plugin does not support ControllerServiceCapability, set it to csi.ControllerServiceCapability_RPC_UNKNOWN. Also set ControllerServer to nil instead of using the default because ControllerServer is not implemented in NFS plugin. If this support is added in the future, capabilities need to be added accordingly. --- pkg/nfs/driver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index fbf4c9c8..4aa9ec87 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -51,6 +51,10 @@ func NewDriver(nodeID, endpoint string) *driver { csiDriver := csicommon.NewCSIDriver(driverName, version, nodeID) csiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER}) + // NFS plugin does not support ControllerServiceCapability now. + // If support is added, it should set to appropriate + // ControllerServiceCapability RPC types. + csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_UNKNOWN}) d.csiDriver = csiDriver @@ -67,7 +71,8 @@ func (d *driver) Run() { s := csicommon.NewNonBlockingGRPCServer() s.Start(d.endpoint, csicommon.NewDefaultIdentityServer(d.csiDriver), - csicommon.NewDefaultControllerServer(d.csiDriver), + // NFS plugin has not implemented ControllerServer. + nil, NewNodeServer(d)) s.Wait() } From 354ff82b12ddb9e112942350ce41d175a5e411e3 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Wed, 14 Mar 2018 08:30:34 -0400 Subject: [PATCH 12/15] fix nfs ddriver.go formating --- pkg/nfs/driver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index 4aa9ec87..72704369 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -54,7 +54,7 @@ func NewDriver(nodeID, endpoint string) *driver { // NFS plugin does not support ControllerServiceCapability now. // If support is added, it should set to appropriate // ControllerServiceCapability RPC types. - csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_UNKNOWN}) + csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_UNKNOWN}) d.csiDriver = csiDriver From 197cfaa5a069500cc7f6f9f662865e616efec7fa Mon Sep 17 00:00:00 2001 From: xing-yang Date: Wed, 14 Mar 2018 15:54:35 +0000 Subject: [PATCH 13/15] Update image links for NFS This PR updates image links for NFS plugin deployment to support CSI 0.2.0. --- pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml | 4 ++-- pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml index 3f372c54..09b53be8 100644 --- a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -30,7 +30,7 @@ spec: serviceAccount: csi-attacher containers: - name: csi-attacher - image: docker.io/k8scsi/csi-attacher + image: quay.io/k8scsi/csi-attacher:v0.2.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -43,7 +43,7 @@ spec: mountPath: /var/lib/csi/sockets/pluginproxy/ - name: nfs - image: docker.io/k8scsi/nfsplugin:v0.1 + image: quay.io/k8scsi/nfsplugin:v0.2.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" diff --git a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml index 030b5e2b..f128108f 100644 --- a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -17,7 +17,7 @@ spec: hostNetwork: true containers: - name: driver-registrar - image: docker.io/k8scsi/driver-registrar + image: quay.io/k8scsi/driver-registrar:v0.2.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -37,7 +37,7 @@ spec: capabilities: add: ["SYS_ADMIN"] allowPrivilegeEscalation: true - image: docker.io/k8scsi/nfsplugin:v0.1 + image: quay.io/k8scsi/nfsplugin:v0.2.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" From 4ad81b11cdaa8bcedc35f7f091dc7a692bf81366 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Mon, 18 Jun 2018 12:29:16 -0400 Subject: [PATCH 14/15] Update to CSI 0.3 --- pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml | 4 ++-- pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml | 4 ++-- pkg/nfs/driver.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml index 09b53be8..c8165fe8 100644 --- a/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -30,7 +30,7 @@ spec: serviceAccount: csi-attacher containers: - name: csi-attacher - image: quay.io/k8scsi/csi-attacher:v0.2.0 + image: quay.io/k8scsi/csi-attacher:v0.3.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -43,7 +43,7 @@ spec: mountPath: /var/lib/csi/sockets/pluginproxy/ - name: nfs - image: quay.io/k8scsi/nfsplugin:v0.2.0 + image: quay.io/k8scsi/nfsplugin:v0.3.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" diff --git a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml index f128108f..457e6f27 100644 --- a/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml +++ b/pkg/nfs/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -17,7 +17,7 @@ spec: hostNetwork: true containers: - name: driver-registrar - image: quay.io/k8scsi/driver-registrar:v0.2.0 + image: quay.io/k8scsi/driver-registrar:v0.3.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -37,7 +37,7 @@ spec: capabilities: add: ["SYS_ADMIN"] allowPrivilegeEscalation: true - image: quay.io/k8scsi/nfsplugin:v0.2.0 + image: quay.io/k8scsi/nfsplugin:v0.3.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index 72704369..6260129e 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -39,7 +39,7 @@ const ( ) var ( - version = "0.2.0" + version = "0.3.0" ) func NewDriver(nodeID, endpoint string) *driver { From 6200e12c217ae7d4d41bb0767afb1ac8714a39ec Mon Sep 17 00:00:00 2001 From: saad-ali Date: Wed, 14 Nov 2018 12:16:46 -0800 Subject: [PATCH 15/15] Code changes for CSI v1.0.0-rc2 --- pkg/nfs/driver.go | 4 ++-- pkg/nfs/nodeserver.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index 6260129e..cc801e9f 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -17,7 +17,7 @@ limitations under the License. package nfs import ( - "github.com/container-storage-interface/spec/lib/go/csi/v0" + "github.com/container-storage-interface/spec/lib/go/csi" "github.com/golang/glog" "github.com/kubernetes-csi/drivers/pkg/csi-common" @@ -39,7 +39,7 @@ const ( ) var ( - version = "0.3.0" + version = "1.0.0-rc2" ) func NewDriver(nodeID, endpoint string) *driver { diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go index ba784ce3..36ced455 100644 --- a/pkg/nfs/nodeserver.go +++ b/pkg/nfs/nodeserver.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/container-storage-interface/spec/lib/go/csi/v0" + "github.com/container-storage-interface/spec/lib/go/csi" "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -58,8 +58,8 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis mo = append(mo, "ro") } - s := req.GetVolumeAttributes()["server"] - ep := req.GetVolumeAttributes()["share"] + s := req.GetVolumeContext()["server"] + ep := req.GetVolumeContext()["share"] source := fmt.Sprintf("%s:%s", s, ep) mounter := mount.New("")