mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-11 22:10:11 +01:00
feat(zfspv): adding backup and restore support (#162)
This commit adds support for Backup and Restore controller, which will be watching for
the events. The velero plugin will create a Backup CR to create a backup
with the remote location information, the controller will send the data
to that remote location.
In the same way, the velero plugin will create a Restore CR to restore the
volume from the the remote location and the restore controller will restore
the data.
Steps to use velero plugin for ZFS-LocalPV are :
1. install velero
2. add openebs plugin
velero plugin add openebs/velero-plugin:latest
3. Create the volumesnapshot location :
for full backup :-
```yaml
apiVersion: velero.io/v1
kind: VolumeSnapshotLocation
metadata:
name: default
namespace: velero
spec:
provider: openebs.io/zfspv-blockstore
config:
bucket: velero
prefix: zfs
namespace: openebs
provider: aws
region: minio
s3ForcePathStyle: "true"
s3Url: http://minio.velero.svc:9000
```
for incremental backup :-
```yaml
apiVersion: velero.io/v1
kind: VolumeSnapshotLocation
metadata:
name: default
namespace: velero
spec:
provider: openebs.io/zfspv-blockstore
config:
bucket: velero
prefix: zfs
backup: incremental
namespace: openebs
provider: aws
region: minio
s3ForcePathStyle: "true"
s3Url: http://minio.velero.svc:9000
```
4. Create backup
velero backup create my-backup --snapshot-volumes --include-namespaces=velero-ns --volume-snapshot-locations=aws-cloud-default --storage-location=default
5. Create Schedule
velero create schedule newschedule --schedule="*/1 * * * *" --snapshot-volumes --include-namespaces=velero-ns --volume-snapshot-locations=aws-local-default --storage-location=default
6. Restore from backup
velero restore create --from-backup my-backup --restore-volumes=true --namespace-mappings velero-ns:ns1
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
a5e645b43d
commit
e40026c98a
48 changed files with 5148 additions and 7 deletions
|
|
@ -28,6 +28,14 @@ type FakeZfsV1 struct {
|
|||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeZfsV1) ZFSBackups(namespace string) v1.ZFSBackupInterface {
|
||||
return &FakeZFSBackups{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeZfsV1) ZFSRestores(namespace string) v1.ZFSRestoreInterface {
|
||||
return &FakeZFSRestores{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeZfsV1) ZFSSnapshots(namespace string) v1.ZFSSnapshotInterface {
|
||||
return &FakeZFSSnapshots{c, namespace}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeZFSBackups implements ZFSBackupInterface
|
||||
type FakeZFSBackups struct {
|
||||
Fake *FakeZfsV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var zfsbackupsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsbackups"}
|
||||
|
||||
var zfsbackupsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSBackup"}
|
||||
|
||||
// Get takes name of the zFSBackup, and returns the corresponding zFSBackup object, and an error if there is any.
|
||||
func (c *FakeZFSBackups) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSBackup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSBackup), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ZFSBackups that match those selectors.
|
||||
func (c *FakeZFSBackups) List(opts v1.ListOptions) (result *zfsv1.ZFSBackupList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(zfsbackupsResource, zfsbackupsKind, c.ns, opts), &zfsv1.ZFSBackupList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &zfsv1.ZFSBackupList{ListMeta: obj.(*zfsv1.ZFSBackupList).ListMeta}
|
||||
for _, item := range obj.(*zfsv1.ZFSBackupList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested zFSBackups.
|
||||
func (c *FakeZFSBackups) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(zfsbackupsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a zFSBackup and creates it. Returns the server's representation of the zFSBackup, and an error, if there is any.
|
||||
func (c *FakeZFSBackups) Create(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBackup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSBackup), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a zFSBackup and updates it. Returns the server's representation of the zFSBackup, and an error, if there is any.
|
||||
func (c *FakeZFSBackups) Update(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBackup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSBackup), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeZFSBackups) UpdateStatus(zFSBackup *zfsv1.ZFSBackup) (*zfsv1.ZFSBackup, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, "status", c.ns, zFSBackup), &zfsv1.ZFSBackup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSBackup), err
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSBackup and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeZFSBackups) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeZFSBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(zfsbackupsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &zfsv1.ZFSBackupList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched zFSBackup.
|
||||
func (c *FakeZFSBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSBackup, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(zfsbackupsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSBackup{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSBackup), err
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeZFSRestores implements ZFSRestoreInterface
|
||||
type FakeZFSRestores struct {
|
||||
Fake *FakeZfsV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var zfsrestoresResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsrestores"}
|
||||
|
||||
var zfsrestoresKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSRestore"}
|
||||
|
||||
// Get takes name of the zFSRestore, and returns the corresponding zFSRestore object, and an error if there is any.
|
||||
func (c *FakeZFSRestores) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSRestore, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSRestore), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ZFSRestores that match those selectors.
|
||||
func (c *FakeZFSRestores) List(opts v1.ListOptions) (result *zfsv1.ZFSRestoreList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(zfsrestoresResource, zfsrestoresKind, c.ns, opts), &zfsv1.ZFSRestoreList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &zfsv1.ZFSRestoreList{ListMeta: obj.(*zfsv1.ZFSRestoreList).ListMeta}
|
||||
for _, item := range obj.(*zfsv1.ZFSRestoreList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested zFSRestores.
|
||||
func (c *FakeZFSRestores) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(zfsrestoresResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a zFSRestore and creates it. Returns the server's representation of the zFSRestore, and an error, if there is any.
|
||||
func (c *FakeZFSRestores) Create(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZFSRestore, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSRestore), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a zFSRestore and updates it. Returns the server's representation of the zFSRestore, and an error, if there is any.
|
||||
func (c *FakeZFSRestores) Update(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZFSRestore, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSRestore), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeZFSRestores) UpdateStatus(zFSRestore *zfsv1.ZFSRestore) (*zfsv1.ZFSRestore, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(zfsrestoresResource, "status", c.ns, zFSRestore), &zfsv1.ZFSRestore{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSRestore), err
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSRestore and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeZFSRestores) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeZFSRestores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(zfsrestoresResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &zfsv1.ZFSRestoreList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched zFSRestore.
|
||||
func (c *FakeZFSRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSRestore, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(zfsrestoresResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSRestore{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*zfsv1.ZFSRestore), err
|
||||
}
|
||||
|
|
@ -18,6 +18,10 @@ limitations under the License.
|
|||
|
||||
package v1
|
||||
|
||||
type ZFSBackupExpansion interface{}
|
||||
|
||||
type ZFSRestoreExpansion interface{}
|
||||
|
||||
type ZFSSnapshotExpansion interface{}
|
||||
|
||||
type ZFSVolumeExpansion interface{}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import (
|
|||
|
||||
type ZfsV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
ZFSBackupsGetter
|
||||
ZFSRestoresGetter
|
||||
ZFSSnapshotsGetter
|
||||
ZFSVolumesGetter
|
||||
}
|
||||
|
|
@ -35,6 +37,14 @@ type ZfsV1Client struct {
|
|||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ZfsV1Client) ZFSBackups(namespace string) ZFSBackupInterface {
|
||||
return newZFSBackups(c, namespace)
|
||||
}
|
||||
|
||||
func (c *ZfsV1Client) ZFSRestores(namespace string) ZFSRestoreInterface {
|
||||
return newZFSRestores(c, namespace)
|
||||
}
|
||||
|
||||
func (c *ZfsV1Client) ZFSSnapshots(namespace string) ZFSSnapshotInterface {
|
||||
return newZFSSnapshots(c, namespace)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
scheme "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ZFSBackupsGetter has a method to return a ZFSBackupInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ZFSBackupsGetter interface {
|
||||
ZFSBackups(namespace string) ZFSBackupInterface
|
||||
}
|
||||
|
||||
// ZFSBackupInterface has methods to work with ZFSBackup resources.
|
||||
type ZFSBackupInterface interface {
|
||||
Create(*v1.ZFSBackup) (*v1.ZFSBackup, error)
|
||||
Update(*v1.ZFSBackup) (*v1.ZFSBackup, error)
|
||||
UpdateStatus(*v1.ZFSBackup) (*v1.ZFSBackup, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
|
||||
Get(name string, options metav1.GetOptions) (*v1.ZFSBackup, error)
|
||||
List(opts metav1.ListOptions) (*v1.ZFSBackupList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSBackup, err error)
|
||||
ZFSBackupExpansion
|
||||
}
|
||||
|
||||
// zFSBackups implements ZFSBackupInterface
|
||||
type zFSBackups struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newZFSBackups returns a ZFSBackups
|
||||
func newZFSBackups(c *ZfsV1Client, namespace string) *zFSBackups {
|
||||
return &zFSBackups{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the zFSBackup, and returns the corresponding zFSBackup object, and an error if there is any.
|
||||
func (c *zFSBackups) Get(name string, options metav1.GetOptions) (result *v1.ZFSBackup, err error) {
|
||||
result = &v1.ZFSBackup{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ZFSBackups that match those selectors.
|
||||
func (c *zFSBackups) List(opts metav1.ListOptions) (result *v1.ZFSBackupList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ZFSBackupList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested zFSBackups.
|
||||
func (c *zFSBackups) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a zFSBackup and creates it. Returns the server's representation of the zFSBackup, and an error, if there is any.
|
||||
func (c *zFSBackups) Create(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) {
|
||||
result = &v1.ZFSBackup{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
Body(zFSBackup).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a zFSBackup and updates it. Returns the server's representation of the zFSBackup, and an error, if there is any.
|
||||
func (c *zFSBackups) Update(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) {
|
||||
result = &v1.ZFSBackup{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
Name(zFSBackup.Name).
|
||||
Body(zFSBackup).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *zFSBackups) UpdateStatus(zFSBackup *v1.ZFSBackup) (result *v1.ZFSBackup, err error) {
|
||||
result = &v1.ZFSBackup{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
Name(zFSBackup.Name).
|
||||
SubResource("status").
|
||||
Body(zFSBackup).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSBackup and deletes it. Returns an error if one occurs.
|
||||
func (c *zFSBackups) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *zFSBackups) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched zFSBackup.
|
||||
func (c *zFSBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSBackup, err error) {
|
||||
result = &v1.ZFSBackup{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("zfsbackups").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
scheme "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ZFSRestoresGetter has a method to return a ZFSRestoreInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ZFSRestoresGetter interface {
|
||||
ZFSRestores(namespace string) ZFSRestoreInterface
|
||||
}
|
||||
|
||||
// ZFSRestoreInterface has methods to work with ZFSRestore resources.
|
||||
type ZFSRestoreInterface interface {
|
||||
Create(*v1.ZFSRestore) (*v1.ZFSRestore, error)
|
||||
Update(*v1.ZFSRestore) (*v1.ZFSRestore, error)
|
||||
UpdateStatus(*v1.ZFSRestore) (*v1.ZFSRestore, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
|
||||
Get(name string, options metav1.GetOptions) (*v1.ZFSRestore, error)
|
||||
List(opts metav1.ListOptions) (*v1.ZFSRestoreList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSRestore, err error)
|
||||
ZFSRestoreExpansion
|
||||
}
|
||||
|
||||
// zFSRestores implements ZFSRestoreInterface
|
||||
type zFSRestores struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newZFSRestores returns a ZFSRestores
|
||||
func newZFSRestores(c *ZfsV1Client, namespace string) *zFSRestores {
|
||||
return &zFSRestores{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the zFSRestore, and returns the corresponding zFSRestore object, and an error if there is any.
|
||||
func (c *zFSRestores) Get(name string, options metav1.GetOptions) (result *v1.ZFSRestore, err error) {
|
||||
result = &v1.ZFSRestore{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ZFSRestores that match those selectors.
|
||||
func (c *zFSRestores) List(opts metav1.ListOptions) (result *v1.ZFSRestoreList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ZFSRestoreList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested zFSRestores.
|
||||
func (c *zFSRestores) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a zFSRestore and creates it. Returns the server's representation of the zFSRestore, and an error, if there is any.
|
||||
func (c *zFSRestores) Create(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) {
|
||||
result = &v1.ZFSRestore{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
Body(zFSRestore).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a zFSRestore and updates it. Returns the server's representation of the zFSRestore, and an error, if there is any.
|
||||
func (c *zFSRestores) Update(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) {
|
||||
result = &v1.ZFSRestore{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
Name(zFSRestore.Name).
|
||||
Body(zFSRestore).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *zFSRestores) UpdateStatus(zFSRestore *v1.ZFSRestore) (result *v1.ZFSRestore, err error) {
|
||||
result = &v1.ZFSRestore{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
Name(zFSRestore.Name).
|
||||
SubResource("status").
|
||||
Body(zFSRestore).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSRestore and deletes it. Returns an error if one occurs.
|
||||
func (c *zFSRestores) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *zFSRestores) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched zFSRestore.
|
||||
func (c *zFSRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSRestore, err error) {
|
||||
result = &v1.ZFSRestore{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("zfsrestores").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue