Skip to content

Commit

Permalink
feat(zfspv): adding backup and restore support for ZFSPV
Browse files Browse the repository at this point in the history
Signed-off-by: Pawan <pawan@mayadata.io>
  • Loading branch information
pawanpraka1 committed Jun 29, 2020
1 parent d0d1664 commit bdbec7a
Show file tree
Hide file tree
Showing 31 changed files with 3,652 additions and 5 deletions.
38 changes: 38 additions & 0 deletions buildscripts/generate-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,38 @@ echo '
cat deploy/yamls/zfs.openebs.io_zfssnapshots.yaml >> deploy/yamls/zfssnapshot-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfssnapshots.yaml


echo '
##############################################
########### ############
########### ZFSBackup CRD ############
########### ############
##############################################
# ZFSBackups CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsbackup-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsbackups.yaml >> deploy/yamls/zfsbackup-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsbackups.yaml


echo '
##############################################
########### ############
########### ZFSRestore CRD ############
########### ############
##############################################
# ZFSRestores CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/zfsrestore-crd.yaml

cat deploy/yamls/zfs.openebs.io_zfsrestores.yaml >> deploy/yamls/zfsrestore-crd.yaml
rm deploy/yamls/zfs.openebs.io_zfsrestores.yaml

## create the operator file using all the yamls

echo '# This manifest is autogenerated via `make manifests` command
Expand All @@ -81,6 +113,12 @@ cat deploy/yamls/zfsvolume-crd.yaml >> deploy/zfs-operator.yaml
# Add ZFSSnapshot v1alpha1 and v1 CRDs to the Operator yaml
cat deploy/yamls/zfssnapshot-crd.yaml >> deploy/zfs-operator.yaml

# Add ZFSBackup v1 CRDs to the Operator yaml
cat deploy/yamls/zfsbackup-crd.yaml >> deploy/zfs-operator.yaml

# Add ZFSRestore v1 CRDs to the Operator yaml
cat deploy/yamls/zfsrestore-crd.yaml >> deploy/zfs-operator.yaml

# Copy the base Operator yaml to CentOS 7 and 8 Operator yamls
cp deploy/zfs-operator.yaml deploy/operators/centos7/zfs-operator.yaml
cp deploy/zfs-operator.yaml deploy/operators/centos8/zfs-operator.yaml
Expand Down
1 change: 1 addition & 0 deletions buildscripts/zfs-driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ FROM ubuntu:19.10
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update; exit 0
RUN apt-get -y install rsyslog libssl-dev xfsprogs ca-certificates
RUN apt-get -y install netcat

ARG ARCH
ARG DBUILD_DATE
Expand Down
198 changes: 198 additions & 0 deletions deploy/operators/centos7/zfs-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,204 @@ status:
conditions: []
storedVersions: []


##############################################
########### ############
########### ZFSBackup CRD ############
########### ############
##############################################

# ZFSBackups CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.8
creationTimestamp: null
name: zfsbackups.zfs.openebs.io
spec:
group: zfs.openebs.io
names:
kind: ZFSBackup
listKind: ZFSBackupList
plural: zfsbackups
shortNames:
- zb
singular: zfsbackup
preserveUnknownFields: false
scope: Namespaced
validation:
openAPIV3Schema:
description: ZFSBackup describes a zfs backup resource created as a custom resource
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ZFSBackupSpec is the spec for a ZFSBackup resource
properties:
backupDest:
description: BackupDest is the remote address for backup transfer
minLength: 1
type: string
backupName:
description: BackupName is a name of the backup or scheduled backup
minLength: 1
type: string
localSnap:
description: LocalSnap is flag to enable local snapshot only
type: boolean
ownerNodeID:
description: OwnerNodeID is a name of the nodes where the source volume
is
minLength: 1
type: string
prevSnapName:
description: PrevSnapName is the last completed-backup's snapshot name
type: string
snapName:
description: SnapName is a name of the current backup snapshot
minLength: 1
type: string
volumeName:
description: VolumeName is a name of the volume for which this backup
is destined
minLength: 1
type: string
required:
- backupDest
- backupName
- localSnap
- ownerNodeID
- snapName
- volumeName
type: object
status:
description: ZFSBackupStatus is to hold status of backup
type: string
required:
- spec
- status
type: object
version: v1
versions:
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []


##############################################
########### ############
########### ZFSRestore CRD ############
########### ############
##############################################

# ZFSRestores CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.8
creationTimestamp: null
name: zfsrestores.zfs.openebs.io
spec:
group: zfs.openebs.io
names:
kind: ZFSRestore
listKind: ZFSRestoreList
plural: zfsrestores
singular: zfsrestore
preserveUnknownFields: false
scope: Namespaced
validation:
openAPIV3Schema:
description: ZFSRestore describes a cstor restore resource created as a custom
resource
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ZFSRestoreSpec is the spec for a ZFSRestore resource
properties:
localRestore:
description: if restore is from local backup/snapshot
type: boolean
ownerNodeID:
description: owner node name where restore volume is present
minLength: 1
type: string
restoreName:
description: restore name
minLength: 1
type: string
restoreSrc:
description: it can be ip:port in case of restore from remote or volumeName
in case of local restore
minLength: 1
type: string
volumeName:
description: volume name to where restore has to be performed
minLength: 1
type: string
required:
- localRestore
- ownerNodeID
- restoreName
- restoreSrc
- volumeName
type: object
status:
description: ZFSRestoreStatus is to hold result of action.
type: string
required:
- spec
- status
type: object
version: v1
versions:
- name: v1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

---

# Create the CSI Driver object
Expand Down
Loading

0 comments on commit bdbec7a

Please sign in to comment.