Skip to content

Add Block volume support for CSI provisioner #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

mkimuram
Copy link
Contributor

Below three logics are implemented to add Block volume support to CSI provisioner:

  1. Add SupportsBlock that properly returns whether Storage
    Provider's plugin supports block (this is checked
    by using ValidateVolumeCapabilities),
  2. Pass BlockVolume instead of MountVolume to CreateVolume
    if volumeMode is set to be Block on Provision,
  3. Set volumeMode to PV returned by Provision.

Also, below 4 test cases for TestSupportsBlock and 2 test cases for TestProvision
are added.

TestSupportsBlock:

  1. ValidateVolumeCapabilities return (true, nil) case: return true expected
  2. ValidateVolumeCapabilities return (false, nil) case: return false expected
  3. ValidateVolumeCapabilities return (true, err) case: return false expected
  4. ValidateVolumeCapabilities return (false, err) case: return false expected

TestProvision:

  1. volumeMode=Filesystem PVC case: return Filesystem PV expected
  2. volumeMode=Block PVC case: return Block PV expected

Fixes #110

mkimuram added 2 commits July 10, 2018 21:47
To update "github.com/kubernetes-incubator/external-storage" to use kubernetes-retired/external-storage#830,
just dep-ensure it doesn't work well with below error.

 # dep ensure -update "github.com/kubernetes-incubator/external-storage"
 # make container
   mkdir -p bin
   CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=v0.2.0-24-g6f650608-dirty -extldflags "-static"' -o ./bin/csi-provisioner ./cmd/csi-provisioner
   # github.com/kubernetes-csi/external-provisioner/vendor/github.com/kubernetes-incubator/external-storage/lib/controller
   vendor/github.com/kubernetes-incubator/external-storage/lib/controller/controller.go:455:39: unknown field 'Limiter' in struct literal of type workqueue.BucketRateLimiter
   vendor/github.com/kubernetes-incubator/external-storage/lib/controller/controller.go:459:40: unknown field 'Limiter' in struct literal of type workqueue.BucketRateLimiter
   make: *** [Makefile:32: csi-provisioner] Error 2

Because kubernetes-incubator/external-storage was changed to access to Limiter in workqueue.BucketRateLimiter in (*1),
and it is introduced to client-go in (*2). So, client-go needs to be updated to the version after this commit.

(*1) Use rate limited work queues and up resync from 15s to 15m
  kubernetes-retired/external-storage@126c9ff

(*2) Switch from juju/ratelimit to golang.org/x/time/rate
  kubernetes/client-go@acc5249

So, Gopkg.toml is updated to make "k8s.io/client-go" use "v7.0.0" instead of "v6.0.0",
and also it is dep-ensure'd.

 # dep ensure -update "k8s.io/client-go"
In CSI provisioner, below three logics need to be implemented,
to add Block volume support to CSI provisioner:

  1. Add SupportsBlock that properly returns whether Storage
     Provider's plugin supports block (this is checked
     by using ValidateVolumeCapabilities),
  2. Pass BlockVolume instead of MountVolume to CreateVolume
     if volumeMode is set to be Block on Provision,
  3. Set volumeMode to PV returned by Provision.

Also, below 4 test cases for TestSupportsBlock and 2 test cases for TestProvision
are added.

TestSupportsBlock:
 1. ValidateVolumeCapabilities return (true, nil) case: return true expected
 2. ValidateVolumeCapabilities return (false, nil) case: return false expected
 3. ValidateVolumeCapabilities return (true, err) case: return false expected
 4. ValidateVolumeCapabilities return (false, err) case: return false expected

TestProvision:
 1. volumeMode=Filesystem PVC case: return Filesystem PV expected
 2. volumeMode=Block PVC case: return Block PV expected

Fixes kubernetes-csi#110
@mkimuram
Copy link
Contributor Author

Close this PR and continue working on this in #135

@mkimuram mkimuram closed this Sep 13, 2018
xing-yang added a commit to xing-yang/external-provisioner that referenced this pull request Nov 19, 2020
c6a88c6ed Merge pull request kubernetes-csi#113 from xing-yang/install_snapshot_controller
45ec4c69f Fix the install of snapshot CRDs and controller

git-subtree-dir: release-tools
git-subtree-split: c6a88c6ed96b939bd150472b12693252942116c7
@xing-yang xing-yang mentioned this pull request Nov 19, 2020
kbsonlong pushed a commit to kbsonlong/external-provisioner that referenced this pull request Dec 29, 2023
kbsonlong pushed a commit to kbsonlong/external-provisioner that referenced this pull request Dec 29, 2023
c6a88c6e Merge pull request kubernetes-csi#113 from xing-yang/install_snapshot_controller
45ec4c69 Fix the install of snapshot CRDs and controller

git-subtree-dir: release-tools
git-subtree-split: c6a88c6ed96b939bd150472b12693252942116c7
rhrmo pushed a commit to rhrmo/external-provisioner that referenced this pull request Mar 31, 2025
…master

NO-JIRA: NO-JIRA: Update bertinatto from OWNERS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant