rexray/gocsi

Input validator prevents MountVolume requests in some cases

Closed this issue · 2 comments

Summary

The field validation found in gocsi/middleware/specvalidator/spec_validator.go:761 is causing MountVolume requests to fail. The function validateFieldSizes requires that fields be less than 128 characters long, but the TargetPath generated and issued by Kubernetes can be over that.

Here is sample output:

time="2018-08-21T01:24:13Z" level=debug msg="/csi.v0.Node/NodePublishVolume: REQ 0026: VolumeId=pvc-a065cfa1-a4e0-11e8-b8a5-08002740ff19, TargetPath=/var/lib/kubelet/pods/ba37c757-a4e0-11e8-b8a5-08002740ff19/volumes/kubernetes.io~csi/pvc-a065cfa1-a4e0-11e8-b8a5-08002740ff19/mount, VolumeCapability=mount:<fs_type:\"ext4\" > access_mode:<mode:SINGLE_NODE_WRITER > , Readonly=false, VolumeAttributes=map[storage.kubernetes.io/csiProvisionerIdentity:1534814514115-8081-com.storidge.csi.cio], XXX_NoUnkeyedLiteral={}, XXX_sizecache=0"
time="2018-08-21T01:24:13Z" level=debug msg="/csi.v0.Node/NodePublishVolume: REP 0026: rpc error: code = InvalidArgument desc = exceeds size limit: TargetPath: max=128, size=131"

As can be seen, Kubernetes has issued a targetPath of length 131. Additionally, there are recorded instances of paths being over length 151. On our system, changing this value to 160+ fixed the issue.

Thanks for your consideration.

Thanks for the comment @Chickaloo. We would welcome a PR to review on this, and otherwise will look to address it for CSI spec.next or 1.0.

akutz commented

Hi @Chickaloo,

The reason for the restriction is CSI places size limits on strings that default to 128 bytes. Is this field exempted?