kubernetes-retired / drivers

[EOL] Example CSI Drivers
Apache License 2.0
140 stars 92 forks source link

hostpath: Add block volume support #143

Closed darkowlzz closed 5 years ago

darkowlzz commented 5 years ago

This change adds block volume support to hostpath driver.

When a block volume request is received, a block file is created at provisionRoot with the requested capacity as size.

At node publish, a loop device is created associated with the block file. This loop device is then symlinked to the publish target path. For read only volume publish, the loop device is created with read only flag.

At node unpublish, the symlinked file is deleted, and the loop device is detached from the block file.

At volume delete, the block file is deleted.

k8s-ci-robot commented 5 years ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: darkowlzz To fully approve this pull request, please assign additional approvers. We suggest the following additional approver: chakri-nelluri

If they are not already assigned, you can assign the PR to them by writing /assign @chakri-nelluri in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubernetes-csi/drivers/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
pohly commented 5 years ago

Wow, that was fast. Thanks a lot @darkowlzz.

Before this can be merged we need to get the hostpath driver moved (https://github.com/kubernetes-csi/csi-driver-host-path/pull/1) and then also move this PR. In the meantime we can discuss it here.

@lpabon: I remember that you were raising the question of handling block devices with symlinks vs. bind mounts. What was the outcome? Is the approach taken here correct?

pohly commented 5 years ago

/hold

I'm holding this because we don't want to add any further changes here. It's still ready for review.

pohly commented 5 years ago

@darkowlzz Please move this PR over to the csi-driver-host-path repo. The code was merged into master of that repo.

darkowlzz commented 5 years ago

Moved to https://github.com/kubernetes-csi/csi-driver-host-path/pull/6