feat(block): adding block volume support for ZFSPV (#102)

This commit adds the support for creating a Raw Block Volume request using volumemode as block in PVC :-

```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: block-claim
spec:
  volumeMode: Block
  storageClassName: zfspv-block
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
```

The driver will create a zvol for this volume and bind mount the block device at the given path.

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan Prakash Sharma 2020-05-05 12:28:46 +05:30 committed by GitHub
parent 49dc99726b
commit dd059a2f43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 274 additions and 10 deletions

View file

@ -179,3 +179,13 @@ func (b *Builder) Build() (*corev1.PersistentVolumeClaim, error) {
}
return b.pvc.object, nil
}
// WithVolumeMode sets the VolumeMode field in PVC with provided arguments
func (b *Builder) WithVolumeMode(volumemode *corev1.PersistentVolumeMode) *Builder {
if volumemode == nil {
b.errs = append(b.errs, errors.New("failed to build PVC object: missing volumemode"))
return b
}
b.pvc.object.Spec.VolumeMode = volumemode
return b
}