Huawei / eSDK_K8S_Plugin

Container-Storage-Interface (CSI) for Huawei storage
Apache License 2.0
82 stars 47 forks source link

Need to create mountpoint to support newer version of CSI interface #21

Closed ljtbbt closed 3 years ago

ljtbbt commented 3 years ago

func (d Driver) NodePublishVolume(ctx context.Context, req csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {

log.Infof("Start to node publish volume %s to %s", volumeId, targetPath)

opts := []string{"bind"}
if req.GetReadonly() {
    opts = append(opts, "ro")
}

//add the following code to it output, err1 := utils.ExecShellCmd("mkdir -p %s", targetPath) if err1 != nil { msg := fmt.Sprintf("failed to mkdir targetPath %s error: %s", targetPath, output) log.Errorln(msg) return nil, status.Error(codes.Internal, msg) }

doubletao318 commented 3 years ago

Yes, this issue has been encountered once in a Kubernetes clusters, but what is the specific version of CSI? In the next version, the mount point check will be added.

ljtbbt commented 3 years ago

Do not know, but I suspect after certain kubernetes version, kube cease to create mountpoint.

doubletao318 commented 3 years ago

kubernetes v1.20. In this version, the mount point is not exist, there is a need for CSI to create the mount point.

doubletao318 commented 3 years ago

rancher01:~/yamls # kubectl get node NAME STATUS ROLES AGE VERSION rancher01 Ready controlplane,etcd,worker 8d v1.20.6 rancher02 Ready worker 8d v1.20.6 rancher03 Ready worker 7d23h v1.20.6

Also, you can feedback your cluster version.