2019-09-12 12:32:17 +05:30
|
|
|
/*
|
|
|
|
|
Copyright © 2019 The OpenEBS Authors
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package v1alpha1
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// +genclient
|
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
|
|
|
// +resource:path=zfsvolume
|
|
|
|
|
|
|
|
|
|
// ZFSVolume represents a ZFS based volume
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:object:root=true
|
|
|
|
|
// +kubebuilder:resource:scope=Namespaced,shortName=zfsvol;zv
|
|
|
|
|
// +kubebuilder:printcolumn:name="ZPool",type=string,JSONPath=`.spec.poolName`,description="ZFS Pool where the volume is created"
|
|
|
|
|
// +kubebuilder:printcolumn:name="Node",type=string,JSONPath=`.spec.ownerNodeID`,description="Node where the volume is created"
|
|
|
|
|
// +kubebuilder:printcolumn:name="Size",type=string,JSONPath=`.spec.capacity`,description="Size of the volume"
|
2020-05-18 16:30:20 +05:30
|
|
|
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.state`,description="Status of the volume"
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:printcolumn:name="Filesystem",type=string,JSONPath=`.spec.fsType`,description="filesystem created on the volume"
|
2020-05-21 13:54:22 +05:30
|
|
|
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of the volume"
|
2019-09-12 12:32:17 +05:30
|
|
|
type ZFSVolume struct {
|
|
|
|
|
metav1.TypeMeta `json:",inline"`
|
|
|
|
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
|
|
|
|
2020-05-18 16:30:20 +05:30
|
|
|
Spec VolumeInfo `json:"spec"`
|
|
|
|
|
Status VolStatus `json:"status,omitempty"`
|
2019-09-12 12:32:17 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MountInfo contains the volume related info
|
|
|
|
|
// for all types of volumes in ZFSVolume
|
|
|
|
|
type MountInfo struct {
|
|
|
|
|
// FSType of a volume will specify the
|
|
|
|
|
// format type - ext4(default), xfs of PV
|
|
|
|
|
FSType string `json:"fsType"`
|
|
|
|
|
|
|
|
|
|
// AccessMode of a volume will hold the
|
|
|
|
|
// access mode of the volume
|
|
|
|
|
AccessModes []string `json:"accessModes"`
|
|
|
|
|
|
|
|
|
|
// MountPath of the volume will hold the
|
|
|
|
|
// path on which the volume is mounted
|
|
|
|
|
// on that node
|
|
|
|
|
MountPath string `json:"mountPath"`
|
|
|
|
|
|
|
|
|
|
// MountOptions specifies the options with
|
|
|
|
|
// which mount needs to be attempted
|
|
|
|
|
MountOptions []string `json:"mountOptions"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
feat(zfspv): adding snapshot and clone support for ZFSPV (#39)
This commits support snapshot and clone commands via CSI driver. User can create snap and clone using the following steps.
Note:
- Snapshot is created via reconciliation CR
- Cloned volume will be on the same zpool where the snapshot is taken
- Cloned volume will have same properties as source volume.
-----------------------------------
Create a Snapshotclass
```
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1beta1
metadata:
name: zfspv-snapclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
driver: zfs.csi.openebs.io
deletionPolicy: Delete
```
Once snapshotclass is created, we can use this class to create a Snapshot
```
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
name: zfspv-snap
spec:
volumeSnapshotClassName: zfspv-snapclass
source:
persistentVolumeClaimName: csi-zfspv
```
```
$ kubectl get volumesnapshot
NAME AGE
zfspv-snap 7m52s
```
```
$ kubectl get volumesnapshot -o yaml
apiVersion: v1
items:
- apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"snapshot.storage.k8s.io/v1beta1","kind":"VolumeSnapshot","metadata":{"annotations":{},"name":"zfspv-snap","namespace":"default"},"spec":{"source":{"persistentVolumeClaimName":"csi-zfspv"},"volumeSnapshotClassName":"zfspv-snapclass"}}
creationTimestamp: "2020-01-30T10:31:24Z"
finalizers:
- snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
- snapshot.storage.kubernetes.io/volumesnapshot-bound-protection
generation: 1
name: zfspv-snap
namespace: default
resourceVersion: "30040"
selfLink: /apis/snapshot.storage.k8s.io/v1beta1/namespaces/default/volumesnapshots/zfspv-snap
uid: 1a5cf166-c599-4f58-9f3c-f1148be47fca
spec:
source:
persistentVolumeClaimName: csi-zfspv
volumeSnapshotClassName: zfspv-snapclass
status:
boundVolumeSnapshotContentName: snapcontent-1a5cf166-c599-4f58-9f3c-f1148be47fca
creationTime: "2020-01-30T10:31:24Z"
readyToUse: true
restoreSize: "0"
kind: List
metadata:
resourceVersion: ""
selfLink: ""
```
Openebs resource for the created snapshot
```
$ kubectl get snap -n openebs -o yaml
apiVersion: v1
items:
- apiVersion: openebs.io/v1alpha1
kind: ZFSSnapshot
metadata:
creationTimestamp: "2020-01-30T10:31:24Z"
finalizers:
- zfs.openebs.io/finalizer
generation: 2
labels:
kubernetes.io/nodename: pawan-2
openebs.io/persistent-volume: pvc-18cab7c3-ec5e-4264-8507-e6f7df4c789a
name: snapshot-1a5cf166-c599-4f58-9f3c-f1148be47fca
namespace: openebs
resourceVersion: "30035"
selfLink: /apis/openebs.io/v1alpha1/namespaces/openebs/zfssnapshots/snapshot-1a5cf166-c599-4f58-9f3c-f1148be47fca
uid: e29d571c-42b5-4fb7-9110-e1cfc9b96641
spec:
capacity: "4294967296"
fsType: zfs
ownerNodeID: pawan-2
poolName: zfspv-pool
status: Ready
volumeType: DATASET
kind: List
metadata:
resourceVersion: ""
selfLink: ""
```
Create a clone volume
We can provide a datasource as snapshot name to create a clone volume
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zfspv-clone
spec:
storageClassName: openebs-zfspv
dataSource:
name: zfspv-snap
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
```
It will create a ZFS clone volume from the mentioned snapshot and create the PV on the same node where original volume is there.
Here, As resize is not supported yet, the clone PVC size should match the size of the snapshot.
Also, all the properties from the storageclass will not be considered for the clone case, it will take the properties from the snapshot and create the clone volume. One thing to note here is that, the storageclass in clone PVC should have the same poolname as that of the original volume as across the pool, clone is not supported.
Signed-off-by: Pawan <pawan@mayadata.io>
2020-02-13 13:31:17 +05:30
|
|
|
// +resource:path=zfsvolumes
|
2019-09-12 12:32:17 +05:30
|
|
|
|
|
|
|
|
// ZFSVolumeList is a list of ZFSVolume resources
|
|
|
|
|
type ZFSVolumeList struct {
|
|
|
|
|
metav1.TypeMeta `json:",inline"`
|
|
|
|
|
metav1.ListMeta `json:"metadata"`
|
|
|
|
|
|
|
|
|
|
Items []ZFSVolume `json:"items"`
|
|
|
|
|
}
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// VolumeInfo defines ZFS volume parameters for all modes in which
|
|
|
|
|
// ZFS volumes can be created like - ZFS volume with filesystem,
|
|
|
|
|
// ZFS Volume exposed as zfs or ZFS volume exposed as raw block device.
|
|
|
|
|
// Some of the parameters can be only set during creation time
|
|
|
|
|
// (as specified in the details of the parameter), and a few are editable.
|
|
|
|
|
// In case of Cloned volumes, the parameters are assigned the same values
|
|
|
|
|
// as the source volume.
|
2019-09-12 12:32:17 +05:30
|
|
|
type VolumeInfo struct {
|
2020-04-01 17:54:20 +05:30
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// OwnerNodeID is the Node ID where the ZPOOL is running which is where
|
|
|
|
|
// the volume has been provisioned.
|
|
|
|
|
// OwnerNodeID can not be edited after the volume has been provisioned.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:MinLength=1
|
|
|
|
|
// +kubebuilder:validation:Required
|
2019-09-12 12:32:17 +05:30
|
|
|
OwnerNodeID string `json:"ownerNodeID"`
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// poolName specifies the name of the pool where the volume has been created.
|
|
|
|
|
// PoolName can not be edited after the volume has been provisioned.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:Required
|
|
|
|
|
// +kubebuilder:validation:MinLength=1
|
2019-09-12 12:32:17 +05:30
|
|
|
PoolName string `json:"poolName"`
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// SnapName specifies the name of the snapshot where the volume has been cloned from.
|
|
|
|
|
// Snapname can not be edited after the volume has been provisioned.
|
feat(zfspv): adding snapshot and clone support for ZFSPV (#39)
This commits support snapshot and clone commands via CSI driver. User can create snap and clone using the following steps.
Note:
- Snapshot is created via reconciliation CR
- Cloned volume will be on the same zpool where the snapshot is taken
- Cloned volume will have same properties as source volume.
-----------------------------------
Create a Snapshotclass
```
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1beta1
metadata:
name: zfspv-snapclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
driver: zfs.csi.openebs.io
deletionPolicy: Delete
```
Once snapshotclass is created, we can use this class to create a Snapshot
```
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
name: zfspv-snap
spec:
volumeSnapshotClassName: zfspv-snapclass
source:
persistentVolumeClaimName: csi-zfspv
```
```
$ kubectl get volumesnapshot
NAME AGE
zfspv-snap 7m52s
```
```
$ kubectl get volumesnapshot -o yaml
apiVersion: v1
items:
- apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"snapshot.storage.k8s.io/v1beta1","kind":"VolumeSnapshot","metadata":{"annotations":{},"name":"zfspv-snap","namespace":"default"},"spec":{"source":{"persistentVolumeClaimName":"csi-zfspv"},"volumeSnapshotClassName":"zfspv-snapclass"}}
creationTimestamp: "2020-01-30T10:31:24Z"
finalizers:
- snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
- snapshot.storage.kubernetes.io/volumesnapshot-bound-protection
generation: 1
name: zfspv-snap
namespace: default
resourceVersion: "30040"
selfLink: /apis/snapshot.storage.k8s.io/v1beta1/namespaces/default/volumesnapshots/zfspv-snap
uid: 1a5cf166-c599-4f58-9f3c-f1148be47fca
spec:
source:
persistentVolumeClaimName: csi-zfspv
volumeSnapshotClassName: zfspv-snapclass
status:
boundVolumeSnapshotContentName: snapcontent-1a5cf166-c599-4f58-9f3c-f1148be47fca
creationTime: "2020-01-30T10:31:24Z"
readyToUse: true
restoreSize: "0"
kind: List
metadata:
resourceVersion: ""
selfLink: ""
```
Openebs resource for the created snapshot
```
$ kubectl get snap -n openebs -o yaml
apiVersion: v1
items:
- apiVersion: openebs.io/v1alpha1
kind: ZFSSnapshot
metadata:
creationTimestamp: "2020-01-30T10:31:24Z"
finalizers:
- zfs.openebs.io/finalizer
generation: 2
labels:
kubernetes.io/nodename: pawan-2
openebs.io/persistent-volume: pvc-18cab7c3-ec5e-4264-8507-e6f7df4c789a
name: snapshot-1a5cf166-c599-4f58-9f3c-f1148be47fca
namespace: openebs
resourceVersion: "30035"
selfLink: /apis/openebs.io/v1alpha1/namespaces/openebs/zfssnapshots/snapshot-1a5cf166-c599-4f58-9f3c-f1148be47fca
uid: e29d571c-42b5-4fb7-9110-e1cfc9b96641
spec:
capacity: "4294967296"
fsType: zfs
ownerNodeID: pawan-2
poolName: zfspv-pool
status: Ready
volumeType: DATASET
kind: List
metadata:
resourceVersion: ""
selfLink: ""
```
Create a clone volume
We can provide a datasource as snapshot name to create a clone volume
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zfspv-clone
spec:
storageClassName: openebs-zfspv
dataSource:
name: zfspv-snap
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
```
It will create a ZFS clone volume from the mentioned snapshot and create the PV on the same node where original volume is there.
Here, As resize is not supported yet, the clone PVC size should match the size of the snapshot.
Also, all the properties from the storageclass will not be considered for the clone case, it will take the properties from the snapshot and create the clone volume. One thing to note here is that, the storageclass in clone PVC should have the same poolname as that of the original volume as across the pool, clone is not supported.
Signed-off-by: Pawan <pawan@mayadata.io>
2020-02-13 13:31:17 +05:30
|
|
|
SnapName string `json:"snapname,omitempty"`
|
|
|
|
|
|
2019-09-12 12:32:17 +05:30
|
|
|
// Capacity of the volume
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// +kubebuilder:validation:Required
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:MinLength=1
|
2019-09-12 12:32:17 +05:30
|
|
|
Capacity string `json:"capacity"`
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// Specifies a suggested block size for files in the file system.
|
|
|
|
|
// The size specified must be a power of two greater than or equal to 512 and less than or equal to 128 Kbytes.
|
|
|
|
|
// RecordSize property can be edited after the volume has been created.
|
|
|
|
|
// Changing the file system's recordsize affects only files created afterward; existing files are unaffected.
|
|
|
|
|
// Default Value: 128k.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:MinLength=1
|
2019-11-21 19:00:15 +05:30
|
|
|
RecordSize string `json:"recordsize,omitempty"`
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// VolBlockSize specifies the block size for the zvol.
|
|
|
|
|
// The volsize can only be set to a multiple of volblocksize, and cannot be zero.
|
|
|
|
|
// VolBlockSize can not be edited after the volume has been provisioned.
|
|
|
|
|
// Default Value: 8k.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:MinLength=1
|
2019-11-21 19:00:15 +05:30
|
|
|
VolBlockSize string `json:"volblocksize,omitempty"`
|
2019-09-12 12:32:17 +05:30
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// Compression specifies the block-level compression algorithm to be applied to the ZFS Volume.
|
|
|
|
|
// The value "on" indicates ZFS to use the default compression algorithm. The default compression
|
|
|
|
|
// algorithm used by ZFS will be either lzjb or, if the lz4_compress feature is enabled, lz4.
|
|
|
|
|
// Compression property can be edited after the volume has been created. The change will only
|
|
|
|
|
// be applied to the newly-written data. For instance, if the Volume was created with "off" and
|
|
|
|
|
// the next day the compression was modified to "on", the data written prior to setting "on" will
|
|
|
|
|
// not be compressed.
|
|
|
|
|
// Default Value: off.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:Pattern="^(on|off|lzjb|gzip|gzip-[1-9]|zle|lz4)$"
|
2019-11-21 19:00:15 +05:30
|
|
|
Compression string `json:"compression,omitempty"`
|
2019-09-12 12:32:17 +05:30
|
|
|
|
2020-04-01 17:54:20 +05:30
|
|
|
// Deduplication is the process for removing redundant data at the block level,
|
|
|
|
|
// reducing the total amount of data stored. If a file system has the dedup property
|
|
|
|
|
// enabled, duplicate data blocks are removed synchronously.
|
|
|
|
|
// The result is that only unique data is stored and common components are shared among files.
|
|
|
|
|
// Deduplication can consume significant processing power (CPU) and memory as well as generate additional disk IO.
|
|
|
|
|
// Before creating a pool with deduplication enabled, ensure that you have planned your hardware
|
|
|
|
|
// requirements appropriately and implemented appropriate recovery practices, such as regular backups.
|
|
|
|
|
// As an alternative to deduplication consider using compression=lz4, as a less resource-intensive alternative.
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// should be enabled on the zvol.
|
|
|
|
|
// Dedup property can be edited after the volume has been created.
|
|
|
|
|
// Default Value: off.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:Enum=on;off
|
2019-11-21 19:00:15 +05:30
|
|
|
Dedup string `json:"dedup,omitempty"`
|
2019-09-12 12:32:17 +05:30
|
|
|
|
2020-04-01 17:54:20 +05:30
|
|
|
// Enabling the encryption feature allows for the creation of
|
|
|
|
|
// encrypted filesystems and volumes. ZFS will encrypt file and zvol data,
|
|
|
|
|
// file attributes, ACLs, permission bits, directory listings, FUID mappings,
|
|
|
|
|
// and userused / groupused data. ZFS will not encrypt metadata related to the
|
|
|
|
|
// pool structure, including dataset and snapshot names, dataset hierarchy,
|
|
|
|
|
// properties, file size, file holes, and deduplication tables
|
|
|
|
|
// (though the deduplicated data itself is encrypted).
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// Default Value: off.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:Pattern="^(on|off|aes-128-[c,g]cm|aes-192-[c,g]cm|aes-256-[c,g]cm)$"
|
2019-11-21 19:00:15 +05:30
|
|
|
Encryption string `json:"encryption,omitempty"`
|
2019-10-15 22:51:48 +05:30
|
|
|
|
2020-04-01 17:54:20 +05:30
|
|
|
// KeyLocation is the location of key for the encryption
|
2019-11-21 19:00:15 +05:30
|
|
|
KeyLocation string `json:"keylocation,omitempty"`
|
2019-10-15 22:51:48 +05:30
|
|
|
|
2020-04-01 17:54:20 +05:30
|
|
|
// KeyFormat specifies format of the encryption key
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// The supported KeyFormats are passphrase, raw, hex.
|
|
|
|
|
// +kubebuilder:validation:Enum=passphrase;raw;hex
|
2019-11-21 19:00:15 +05:30
|
|
|
KeyFormat string `json:"keyformat,omitempty"`
|
2019-10-15 22:51:48 +05:30
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// ThinProvision describes whether space reservation for the source volume is required or not.
|
|
|
|
|
// The value "yes" indicates that volume should be thin provisioned and "no" means thick provisioning of the volume.
|
|
|
|
|
// If thinProvision is set to "yes" then volume can be provisioned even if the ZPOOL does not
|
|
|
|
|
// have the enough capacity.
|
|
|
|
|
// If thinProvision is set to "no" then volume can be provisioned only if the ZPOOL has enough
|
|
|
|
|
// capacity and capacity required by volume can be reserved.
|
|
|
|
|
// ThinProvision can not be modified once volume has been provisioned.
|
|
|
|
|
// Default Value: no.
|
|
|
|
|
// +kubebuilder:validation:Enum=yes;no
|
2019-11-21 19:00:15 +05:30
|
|
|
ThinProvision string `json:"thinProvision,omitempty"`
|
|
|
|
|
|
2020-04-01 17:54:20 +05:30
|
|
|
// volumeType determines whether the volume is of type "DATASET" or "ZVOL".
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// If fstype provided in the storageclass is "zfs", a volume of type dataset will be created.
|
|
|
|
|
// If "ext4", "ext3", "ext2" or "xfs" is mentioned as fstype
|
|
|
|
|
// in the storageclass, then a volume of type zvol will be created, which will be
|
|
|
|
|
// further formatted as the fstype provided in the storageclass.
|
|
|
|
|
// VolumeType can not be modified once volume has been provisioned.
|
2020-04-01 17:54:20 +05:30
|
|
|
// +kubebuilder:validation:Required
|
|
|
|
|
// +kubebuilder:validation:Enum=ZVOL;DATASET
|
2019-11-21 19:00:15 +05:30
|
|
|
VolumeType string `json:"volumeType"`
|
|
|
|
|
|
feat(validation): adding validation for ZFSPV CR parameters (#66)
Validating few parameters for the ZFSVolume custom resource
- compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4"
- encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm"
- dedup can be "on" and "off"
- poolname can be string
- ownernodeid can be string
- thinprovision can be "yes" and "no"
- volumetype can be "DATASET" and "ZVOL"
Also added required fields needed to create ZFSVolume CR
- ownerNodeID
- poolname
- volumeType
- capacity
Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-14 17:26:46 +05:30
|
|
|
// FsType specifies filesystem type for the zfs volume/dataset.
|
|
|
|
|
// If FsType is provided as "zfs", then the driver will create a
|
|
|
|
|
// ZFS dataset, formatting is not required as underlying filesystem is ZFS anyway.
|
|
|
|
|
// If FsType is ext2, ext3, ext4 or xfs, then the driver will create a ZVOL and
|
|
|
|
|
// format the volume accordingly.
|
|
|
|
|
// FsType can not be modified once volume has been provisioned.
|
|
|
|
|
// Default Value: ext4.
|
2019-11-21 19:00:15 +05:30
|
|
|
FsType string `json:"fsType,omitempty"`
|
2019-09-12 12:32:17 +05:30
|
|
|
}
|
2020-05-18 16:30:20 +05:30
|
|
|
|
|
|
|
|
type VolStatus struct {
|
|
|
|
|
// State specifies the current state of the volume provisioning request.
|
|
|
|
|
// The state "Pending" means that the volume creation request has not
|
|
|
|
|
// processed yet. The state "Ready" means that the volume has been created
|
|
|
|
|
// and it is ready for the use.
|
|
|
|
|
// +kubebuilder:validation:Enum=Pending;Ready
|
|
|
|
|
State string `json:"state,omitempty"`
|
|
|
|
|
}
|