refact(deps): bump k8s and client-go deps to version v0.20.2 (#294)

Signed-off-by: prateekpandey14 <prateek.pandey@mayadata.io>
This commit is contained in:
Prateek Pandey 2021-03-31 16:43:42 +05:30 committed by GitHub
parent 533e17a9aa
commit b1aa6ab51a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2196 changed files with 306727 additions and 251810 deletions

View file

@ -15,6 +15,7 @@
package bkpbuilder
import (
"context"
"encoding/json"
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
@ -142,7 +143,7 @@ func defaultGet(
) (*apis.ZFSBackup, error) {
return cli.ZfsV1().
ZFSBackups(namespace).
Get(name, opts)
Get(context.TODO(), name, opts)
}
// defaultList is the default implementation to list
@ -154,7 +155,7 @@ func defaultList(
) (*apis.ZFSBackupList, error) {
return cli.ZfsV1().
ZFSBackups(namespace).
List(opts)
List(context.TODO(), opts)
}
// defaultCreate is the default implementation to delete
@ -168,7 +169,7 @@ func defaultDel(
opts.PropagationPolicy = &deletePropagation
err := cli.ZfsV1().
ZFSBackups(namespace).
Delete(name, opts)
Delete(context.TODO(), name, *opts)
return err
}
@ -181,7 +182,7 @@ func defaultCreate(
) (*apis.ZFSBackup, error) {
return cli.ZfsV1().
ZFSBackups(namespace).
Create(bkp)
Create(context.TODO(), bkp, metav1.CreateOptions{})
}
// defaultUpdate is the default implementation to update
@ -193,7 +194,7 @@ func defaultUpdate(
) (*apis.ZFSBackup, error) {
return cli.ZfsV1().
ZFSBackups(namespace).
Update(bkp)
Update(context.TODO(), bkp, metav1.UpdateOptions{})
}
// withDefaults sets the default options

View file

@ -15,6 +15,7 @@
package restorebuilder
import (
"context"
"encoding/json"
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
@ -142,7 +143,7 @@ func defaultGet(
) (*apis.ZFSRestore, error) {
return cli.ZfsV1().
ZFSRestores(namespace).
Get(name, opts)
Get(context.TODO(), name, opts)
}
// defaultList is the default implementation to list
@ -154,7 +155,7 @@ func defaultList(
) (*apis.ZFSRestoreList, error) {
return cli.ZfsV1().
ZFSRestores(namespace).
List(opts)
List(context.TODO(), opts)
}
// defaultCreate is the default implementation to delete
@ -168,7 +169,7 @@ func defaultDel(
opts.PropagationPolicy = &deletePropagation
err := cli.ZfsV1().
ZFSRestores(namespace).
Delete(name, opts)
Delete(context.TODO(), name, *opts)
return err
}
@ -181,7 +182,7 @@ func defaultCreate(
) (*apis.ZFSRestore, error) {
return cli.ZfsV1().
ZFSRestores(namespace).
Create(rstr)
Create(context.TODO(), rstr, metav1.CreateOptions{})
}
// defaultUpdate is the default implementation to update
@ -193,7 +194,7 @@ func defaultUpdate(
) (*apis.ZFSRestore, error) {
return cli.ZfsV1().
ZFSRestores(namespace).
Update(rstr)
Update(context.TODO(), rstr, metav1.UpdateOptions{})
}
// withDefaults sets the default options

View file

@ -15,6 +15,7 @@
package snapbuilder
import (
"context"
"encoding/json"
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
@ -142,7 +143,7 @@ func defaultGet(
) (*apis.ZFSSnapshot, error) {
return cli.ZfsV1().
ZFSSnapshots(namespace).
Get(name, opts)
Get(context.TODO(), name, opts)
}
// defaultList is the default implementation to list
@ -154,7 +155,7 @@ func defaultList(
) (*apis.ZFSSnapshotList, error) {
return cli.ZfsV1().
ZFSSnapshots(namespace).
List(opts)
List(context.TODO(), opts)
}
// defaultCreate is the default implementation to delete
@ -168,7 +169,7 @@ func defaultDel(
opts.PropagationPolicy = &deletePropagation
err := cli.ZfsV1().
ZFSSnapshots(namespace).
Delete(name, opts)
Delete(context.TODO(), name, *opts)
return err
}
@ -181,7 +182,7 @@ func defaultCreate(
) (*apis.ZFSSnapshot, error) {
return cli.ZfsV1().
ZFSSnapshots(namespace).
Create(vol)
Create(context.TODO(), vol, metav1.CreateOptions{})
}
// defaultUpdate is the default implementation to update
@ -193,7 +194,7 @@ func defaultUpdate(
) (*apis.ZFSSnapshot, error) {
return cli.ZfsV1().
ZFSSnapshots(namespace).
Update(vol)
Update(context.TODO(), vol, metav1.UpdateOptions{})
}
// withDefaults sets the default options

View file

@ -15,6 +15,7 @@
package volbuilder
import (
"context"
"encoding/json"
client "github.com/openebs/lib-csi/pkg/common/kubernetes/client"
@ -142,7 +143,7 @@ func defaultGet(
) (*apis.ZFSVolume, error) {
return cli.ZfsV1().
ZFSVolumes(namespace).
Get(name, opts)
Get(context.TODO(), name, opts)
}
// defaultList is the default implementation to list
@ -154,7 +155,7 @@ func defaultList(
) (*apis.ZFSVolumeList, error) {
return cli.ZfsV1().
ZFSVolumes(namespace).
List(opts)
List(context.TODO(), opts)
}
// defaultCreate is the default implementation to delete
@ -168,7 +169,7 @@ func defaultDel(
opts.PropagationPolicy = &deletePropagation
err := cli.ZfsV1().
ZFSVolumes(namespace).
Delete(name, opts)
Delete(context.TODO(), name, *opts)
return err
}
@ -181,7 +182,7 @@ func defaultCreate(
) (*apis.ZFSVolume, error) {
return cli.ZfsV1().
ZFSVolumes(namespace).
Create(vol)
Create(context.TODO(), vol, metav1.CreateOptions{})
}
// defaultUpdate is the default implementation to update
@ -193,7 +194,7 @@ func defaultUpdate(
) (*apis.ZFSVolume, error) {
return cli.ZfsV1().
ZFSVolumes(namespace).
Update(vol)
Update(context.TODO(), vol, metav1.UpdateOptions{})
}
// withDefaults sets the default options

View file

@ -200,9 +200,12 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
return "", status.Errorf(codes.Internal, "get node map failed : %s", err.Error())
}
// run the scheduler
selected := schd.Scheduler(req, nmap)
// run the scheduler get the preferred nodelist
var selected string
nodelist := schd.Scheduler(req, nmap)
if len(nodelist) != 0 {
selected = nodelist[0]
}
if len(selected) == 0 {
// (hack): CSI Sanity test does not pass topology information
selected = parameters["node"]

View file

@ -19,6 +19,8 @@ limitations under the License.
package internalclientset
import (
"fmt"
zfsv1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
@ -51,9 +53,14 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
}
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset

View file

@ -29,7 +29,7 @@ import (
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
zfsv1.AddToScheme,
}

View file

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
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"
@ -39,7 +41,7 @@ var zfsbackupsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Ve
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) {
func (c *FakeZFSBackups) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
@ -50,7 +52,7 @@ func (c *FakeZFSBackups) Get(name string, options v1.GetOptions) (result *zfsv1.
}
// 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) {
func (c *FakeZFSBackups) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSBackupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsbackupsResource, zfsbackupsKind, c.ns, opts), &zfsv1.ZFSBackupList{})
@ -72,14 +74,14 @@ func (c *FakeZFSBackups) List(opts v1.ListOptions) (result *zfsv1.ZFSBackupList,
}
// Watch returns a watch.Interface that watches the requested zFSBackups.
func (c *FakeZFSBackups) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSBackups) Watch(ctx context.Context, 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) {
func (c *FakeZFSBackups) Create(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.CreateOptions) (result *zfsv1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
@ -90,7 +92,7 @@ func (c *FakeZFSBackups) Create(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBa
}
// 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) {
func (c *FakeZFSBackups) Update(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.UpdateOptions) (result *zfsv1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
@ -102,7 +104,7 @@ func (c *FakeZFSBackups) Update(zFSBackup *zfsv1.ZFSBackup) (result *zfsv1.ZFSBa
// 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) {
func (c *FakeZFSBackups) UpdateStatus(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.UpdateOptions) (*zfsv1.ZFSBackup, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, "status", c.ns, zFSBackup), &zfsv1.ZFSBackup{})
@ -113,7 +115,7 @@ func (c *FakeZFSBackups) UpdateStatus(zFSBackup *zfsv1.ZFSBackup) (*zfsv1.ZFSBac
}
// 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 {
func (c *FakeZFSBackups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
@ -121,15 +123,15 @@ func (c *FakeZFSBackups) Delete(name string, options *v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsbackupsResource, c.ns, listOptions)
func (c *FakeZFSBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsbackupsResource, c.ns, listOpts)
_, 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) {
func (c *FakeZFSBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsbackupsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSBackup{})

View file

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
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"
@ -39,7 +41,7 @@ var zfsrestoresResource = schema.GroupVersionResource{Group: "zfs.openebs.io", V
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) {
func (c *FakeZFSRestores) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
@ -50,7 +52,7 @@ func (c *FakeZFSRestores) Get(name string, options v1.GetOptions) (result *zfsv1
}
// 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) {
func (c *FakeZFSRestores) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSRestoreList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsrestoresResource, zfsrestoresKind, c.ns, opts), &zfsv1.ZFSRestoreList{})
@ -72,14 +74,14 @@ func (c *FakeZFSRestores) List(opts v1.ListOptions) (result *zfsv1.ZFSRestoreLis
}
// Watch returns a watch.Interface that watches the requested zFSRestores.
func (c *FakeZFSRestores) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSRestores) Watch(ctx context.Context, 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) {
func (c *FakeZFSRestores) Create(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.CreateOptions) (result *zfsv1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
@ -90,7 +92,7 @@ func (c *FakeZFSRestores) Create(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZF
}
// 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) {
func (c *FakeZFSRestores) Update(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.UpdateOptions) (result *zfsv1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
@ -102,7 +104,7 @@ func (c *FakeZFSRestores) Update(zFSRestore *zfsv1.ZFSRestore) (result *zfsv1.ZF
// 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) {
func (c *FakeZFSRestores) UpdateStatus(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.UpdateOptions) (*zfsv1.ZFSRestore, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsrestoresResource, "status", c.ns, zFSRestore), &zfsv1.ZFSRestore{})
@ -113,7 +115,7 @@ func (c *FakeZFSRestores) UpdateStatus(zFSRestore *zfsv1.ZFSRestore) (*zfsv1.ZFS
}
// 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 {
func (c *FakeZFSRestores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
@ -121,15 +123,15 @@ func (c *FakeZFSRestores) Delete(name string, options *v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSRestores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsrestoresResource, c.ns, listOptions)
func (c *FakeZFSRestores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsrestoresResource, c.ns, listOpts)
_, 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) {
func (c *FakeZFSRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsrestoresResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSRestore{})

View file

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
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"
@ -39,7 +41,7 @@ var zfssnapshotsResource = schema.GroupVersionResource{Group: "zfs.openebs.io",
var zfssnapshotsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSSnapshot"}
// Get takes name of the zFSSnapshot, and returns the corresponding zFSSnapshot object, and an error if there is any.
func (c *FakeZFSSnapshots) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfssnapshotsResource, c.ns, name), &zfsv1.ZFSSnapshot{})
@ -50,7 +52,7 @@ func (c *FakeZFSSnapshots) Get(name string, options v1.GetOptions) (result *zfsv
}
// List takes label and field selectors, and returns the list of ZFSSnapshots that match those selectors.
func (c *FakeZFSSnapshots) List(opts v1.ListOptions) (result *zfsv1.ZFSSnapshotList, err error) {
func (c *FakeZFSSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSSnapshotList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfssnapshotsResource, zfssnapshotsKind, c.ns, opts), &zfsv1.ZFSSnapshotList{})
@ -72,14 +74,14 @@ func (c *FakeZFSSnapshots) List(opts v1.ListOptions) (result *zfsv1.ZFSSnapshotL
}
// Watch returns a watch.Interface that watches the requested zFSSnapshots.
func (c *FakeZFSSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(zfssnapshotsResource, c.ns, opts))
}
// Create takes the representation of a zFSSnapshot and creates it. Returns the server's representation of the zFSSnapshot, and an error, if there is any.
func (c *FakeZFSSnapshots) Create(zFSSnapshot *zfsv1.ZFSSnapshot) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Create(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.CreateOptions) (result *zfsv1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
@ -90,7 +92,7 @@ func (c *FakeZFSSnapshots) Create(zFSSnapshot *zfsv1.ZFSSnapshot) (result *zfsv1
}
// Update takes the representation of a zFSSnapshot and updates it. Returns the server's representation of the zFSSnapshot, and an error, if there is any.
func (c *FakeZFSSnapshots) Update(zFSSnapshot *zfsv1.ZFSSnapshot) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Update(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.UpdateOptions) (result *zfsv1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
@ -102,7 +104,7 @@ func (c *FakeZFSSnapshots) Update(zFSSnapshot *zfsv1.ZFSSnapshot) (result *zfsv1
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeZFSSnapshots) UpdateStatus(zFSSnapshot *zfsv1.ZFSSnapshot) (*zfsv1.ZFSSnapshot, error) {
func (c *FakeZFSSnapshots) UpdateStatus(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.UpdateOptions) (*zfsv1.ZFSSnapshot, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfssnapshotsResource, "status", c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
@ -113,7 +115,7 @@ func (c *FakeZFSSnapshots) UpdateStatus(zFSSnapshot *zfsv1.ZFSSnapshot) (*zfsv1.
}
// Delete takes name of the zFSSnapshot and deletes it. Returns an error if one occurs.
func (c *FakeZFSSnapshots) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeZFSSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfssnapshotsResource, c.ns, name), &zfsv1.ZFSSnapshot{})
@ -121,15 +123,15 @@ func (c *FakeZFSSnapshots) Delete(name string, options *v1.DeleteOptions) error
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfssnapshotsResource, c.ns, listOptions)
func (c *FakeZFSSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfssnapshotsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSSnapshotList{})
return err
}
// Patch applies the patch and returns the patched zFSSnapshot.
func (c *FakeZFSSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfssnapshotsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSSnapshot{})

View file

@ -19,6 +19,8 @@ limitations under the License.
package fake
import (
"context"
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"
@ -39,7 +41,7 @@ var zfsvolumesResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Ve
var zfsvolumesKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSVolume"}
// Get takes name of the zFSVolume, and returns the corresponding zFSVolume object, and an error if there is any.
func (c *FakeZFSVolumes) Get(name string, options v1.GetOptions) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsvolumesResource, c.ns, name), &zfsv1.ZFSVolume{})
@ -50,7 +52,7 @@ func (c *FakeZFSVolumes) Get(name string, options v1.GetOptions) (result *zfsv1.
}
// List takes label and field selectors, and returns the list of ZFSVolumes that match those selectors.
func (c *FakeZFSVolumes) List(opts v1.ListOptions) (result *zfsv1.ZFSVolumeList, err error) {
func (c *FakeZFSVolumes) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSVolumeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsvolumesResource, zfsvolumesKind, c.ns, opts), &zfsv1.ZFSVolumeList{})
@ -72,14 +74,14 @@ func (c *FakeZFSVolumes) List(opts v1.ListOptions) (result *zfsv1.ZFSVolumeList,
}
// Watch returns a watch.Interface that watches the requested zFSVolumes.
func (c *FakeZFSVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSVolumes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(zfsvolumesResource, c.ns, opts))
}
// Create takes the representation of a zFSVolume and creates it. Returns the server's representation of the zFSVolume, and an error, if there is any.
func (c *FakeZFSVolumes) Create(zFSVolume *zfsv1.ZFSVolume) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Create(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.CreateOptions) (result *zfsv1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsvolumesResource, c.ns, zFSVolume), &zfsv1.ZFSVolume{})
@ -90,7 +92,7 @@ func (c *FakeZFSVolumes) Create(zFSVolume *zfsv1.ZFSVolume) (result *zfsv1.ZFSVo
}
// Update takes the representation of a zFSVolume and updates it. Returns the server's representation of the zFSVolume, and an error, if there is any.
func (c *FakeZFSVolumes) Update(zFSVolume *zfsv1.ZFSVolume) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Update(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.UpdateOptions) (result *zfsv1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsvolumesResource, c.ns, zFSVolume), &zfsv1.ZFSVolume{})
@ -102,7 +104,7 @@ func (c *FakeZFSVolumes) Update(zFSVolume *zfsv1.ZFSVolume) (result *zfsv1.ZFSVo
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeZFSVolumes) UpdateStatus(zFSVolume *zfsv1.ZFSVolume) (*zfsv1.ZFSVolume, error) {
func (c *FakeZFSVolumes) UpdateStatus(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.UpdateOptions) (*zfsv1.ZFSVolume, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsvolumesResource, "status", c.ns, zFSVolume), &zfsv1.ZFSVolume{})
@ -113,7 +115,7 @@ func (c *FakeZFSVolumes) UpdateStatus(zFSVolume *zfsv1.ZFSVolume) (*zfsv1.ZFSVol
}
// Delete takes name of the zFSVolume and deletes it. Returns an error if one occurs.
func (c *FakeZFSVolumes) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeZFSVolumes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsvolumesResource, c.ns, name), &zfsv1.ZFSVolume{})
@ -121,15 +123,15 @@ func (c *FakeZFSVolumes) Delete(name string, options *v1.DeleteOptions) error {
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsvolumesResource, c.ns, listOptions)
func (c *FakeZFSVolumes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsvolumesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSVolumeList{})
return err
}
// Patch applies the patch and returns the patched zFSVolume.
func (c *FakeZFSVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsvolumesResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSVolume{})

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
"time"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -37,15 +38,15 @@ type ZFSBackupsGetter interface {
// 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)
Create(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.CreateOptions) (*v1.ZFSBackup, error)
Update(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (*v1.ZFSBackup, error)
UpdateStatus(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (*v1.ZFSBackup, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ZFSBackup, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ZFSBackupList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSBackup, err error)
ZFSBackupExpansion
}
@ -64,20 +65,20 @@ func newZFSBackups(c *ZfsV1Client, namespace string) *zFSBackups {
}
// 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) {
func (c *zFSBackups) Get(ctx context.Context, 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().
Do(ctx).
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) {
func (c *zFSBackups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSBackupList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *zFSBackups) List(opts metav1.ListOptions) (result *v1.ZFSBackupList, er
Resource("zfsbackups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested zFSBackups.
func (c *zFSBackups) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *zFSBackups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -105,87 +106,90 @@ func (c *zFSBackups) Watch(opts metav1.ListOptions) (watch.Interface, error) {
Resource("zfsbackups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// 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) {
func (c *zFSBackups) Create(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.CreateOptions) (result *v1.ZFSBackup, err error) {
result = &v1.ZFSBackup{}
err = c.client.Post().
Namespace(c.ns).
Resource("zfsbackups").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSBackup).
Do().
Do(ctx).
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) {
func (c *zFSBackups) Update(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (result *v1.ZFSBackup, err error) {
result = &v1.ZFSBackup{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsbackups").
Name(zFSBackup.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSBackup).
Do().
Do(ctx).
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) {
func (c *zFSBackups) UpdateStatus(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (result *v1.ZFSBackup, err error) {
result = &v1.ZFSBackup{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsbackups").
Name(zFSBackup.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSBackup).
Do().
Do(ctx).
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 {
func (c *zFSBackups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("zfsbackups").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *zFSBackups) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *zFSBackups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("zfsbackups").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
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) {
func (c *zFSBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSBackup, err error) {
result = &v1.ZFSBackup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("zfsbackups").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
"time"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -37,15 +38,15 @@ type ZFSRestoresGetter interface {
// 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)
Create(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.CreateOptions) (*v1.ZFSRestore, error)
Update(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (*v1.ZFSRestore, error)
UpdateStatus(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (*v1.ZFSRestore, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ZFSRestore, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ZFSRestoreList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSRestore, err error)
ZFSRestoreExpansion
}
@ -64,20 +65,20 @@ func newZFSRestores(c *ZfsV1Client, namespace string) *zFSRestores {
}
// 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) {
func (c *zFSRestores) Get(ctx context.Context, 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().
Do(ctx).
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) {
func (c *zFSRestores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSRestoreList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *zFSRestores) List(opts metav1.ListOptions) (result *v1.ZFSRestoreList,
Resource("zfsrestores").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested zFSRestores.
func (c *zFSRestores) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *zFSRestores) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -105,87 +106,90 @@ func (c *zFSRestores) Watch(opts metav1.ListOptions) (watch.Interface, error) {
Resource("zfsrestores").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// 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) {
func (c *zFSRestores) Create(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.CreateOptions) (result *v1.ZFSRestore, err error) {
result = &v1.ZFSRestore{}
err = c.client.Post().
Namespace(c.ns).
Resource("zfsrestores").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSRestore).
Do().
Do(ctx).
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) {
func (c *zFSRestores) Update(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (result *v1.ZFSRestore, err error) {
result = &v1.ZFSRestore{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsrestores").
Name(zFSRestore.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSRestore).
Do().
Do(ctx).
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) {
func (c *zFSRestores) UpdateStatus(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (result *v1.ZFSRestore, err error) {
result = &v1.ZFSRestore{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsrestores").
Name(zFSRestore.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSRestore).
Do().
Do(ctx).
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 {
func (c *zFSRestores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("zfsrestores").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *zFSRestores) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *zFSRestores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("zfsrestores").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
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) {
func (c *zFSRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSRestore, err error) {
result = &v1.ZFSRestore{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("zfsrestores").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
"time"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -37,15 +38,15 @@ type ZFSSnapshotsGetter interface {
// ZFSSnapshotInterface has methods to work with ZFSSnapshot resources.
type ZFSSnapshotInterface interface {
Create(*v1.ZFSSnapshot) (*v1.ZFSSnapshot, error)
Update(*v1.ZFSSnapshot) (*v1.ZFSSnapshot, error)
UpdateStatus(*v1.ZFSSnapshot) (*v1.ZFSSnapshot, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ZFSSnapshot, error)
List(opts metav1.ListOptions) (*v1.ZFSSnapshotList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSSnapshot, err error)
Create(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.CreateOptions) (*v1.ZFSSnapshot, error)
Update(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (*v1.ZFSSnapshot, error)
UpdateStatus(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (*v1.ZFSSnapshot, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ZFSSnapshot, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ZFSSnapshotList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSSnapshot, err error)
ZFSSnapshotExpansion
}
@ -64,20 +65,20 @@ func newZFSSnapshots(c *ZfsV1Client, namespace string) *zFSSnapshots {
}
// Get takes name of the zFSSnapshot, and returns the corresponding zFSSnapshot object, and an error if there is any.
func (c *zFSSnapshots) Get(name string, options metav1.GetOptions) (result *v1.ZFSSnapshot, err error) {
func (c *zFSSnapshots) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSSnapshot, err error) {
result = &v1.ZFSSnapshot{}
err = c.client.Get().
Namespace(c.ns).
Resource("zfssnapshots").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ZFSSnapshots that match those selectors.
func (c *zFSSnapshots) List(opts metav1.ListOptions) (result *v1.ZFSSnapshotList, err error) {
func (c *zFSSnapshots) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSSnapshotList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *zFSSnapshots) List(opts metav1.ListOptions) (result *v1.ZFSSnapshotList
Resource("zfssnapshots").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested zFSSnapshots.
func (c *zFSSnapshots) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *zFSSnapshots) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -105,87 +106,90 @@ func (c *zFSSnapshots) Watch(opts metav1.ListOptions) (watch.Interface, error) {
Resource("zfssnapshots").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a zFSSnapshot and creates it. Returns the server's representation of the zFSSnapshot, and an error, if there is any.
func (c *zFSSnapshots) Create(zFSSnapshot *v1.ZFSSnapshot) (result *v1.ZFSSnapshot, err error) {
func (c *zFSSnapshots) Create(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.CreateOptions) (result *v1.ZFSSnapshot, err error) {
result = &v1.ZFSSnapshot{}
err = c.client.Post().
Namespace(c.ns).
Resource("zfssnapshots").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSSnapshot).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a zFSSnapshot and updates it. Returns the server's representation of the zFSSnapshot, and an error, if there is any.
func (c *zFSSnapshots) Update(zFSSnapshot *v1.ZFSSnapshot) (result *v1.ZFSSnapshot, err error) {
func (c *zFSSnapshots) Update(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (result *v1.ZFSSnapshot, err error) {
result = &v1.ZFSSnapshot{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfssnapshots").
Name(zFSSnapshot.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSSnapshot).
Do().
Do(ctx).
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 *zFSSnapshots) UpdateStatus(zFSSnapshot *v1.ZFSSnapshot) (result *v1.ZFSSnapshot, err error) {
func (c *zFSSnapshots) UpdateStatus(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (result *v1.ZFSSnapshot, err error) {
result = &v1.ZFSSnapshot{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfssnapshots").
Name(zFSSnapshot.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSSnapshot).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the zFSSnapshot and deletes it. Returns an error if one occurs.
func (c *zFSSnapshots) Delete(name string, options *metav1.DeleteOptions) error {
func (c *zFSSnapshots) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("zfssnapshots").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *zFSSnapshots) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *zFSSnapshots) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("zfssnapshots").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched zFSSnapshot.
func (c *zFSSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSSnapshot, err error) {
func (c *zFSSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSSnapshot, err error) {
result = &v1.ZFSSnapshot{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("zfssnapshots").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
"time"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -37,15 +38,15 @@ type ZFSVolumesGetter interface {
// ZFSVolumeInterface has methods to work with ZFSVolume resources.
type ZFSVolumeInterface interface {
Create(*v1.ZFSVolume) (*v1.ZFSVolume, error)
Update(*v1.ZFSVolume) (*v1.ZFSVolume, error)
UpdateStatus(*v1.ZFSVolume) (*v1.ZFSVolume, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ZFSVolume, error)
List(opts metav1.ListOptions) (*v1.ZFSVolumeList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSVolume, err error)
Create(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.CreateOptions) (*v1.ZFSVolume, error)
Update(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (*v1.ZFSVolume, error)
UpdateStatus(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (*v1.ZFSVolume, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ZFSVolume, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ZFSVolumeList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSVolume, err error)
ZFSVolumeExpansion
}
@ -64,20 +65,20 @@ func newZFSVolumes(c *ZfsV1Client, namespace string) *zFSVolumes {
}
// Get takes name of the zFSVolume, and returns the corresponding zFSVolume object, and an error if there is any.
func (c *zFSVolumes) Get(name string, options metav1.GetOptions) (result *v1.ZFSVolume, err error) {
func (c *zFSVolumes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSVolume, err error) {
result = &v1.ZFSVolume{}
err = c.client.Get().
Namespace(c.ns).
Resource("zfsvolumes").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ZFSVolumes that match those selectors.
func (c *zFSVolumes) List(opts metav1.ListOptions) (result *v1.ZFSVolumeList, err error) {
func (c *zFSVolumes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSVolumeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *zFSVolumes) List(opts metav1.ListOptions) (result *v1.ZFSVolumeList, er
Resource("zfsvolumes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested zFSVolumes.
func (c *zFSVolumes) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *zFSVolumes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -105,87 +106,90 @@ func (c *zFSVolumes) Watch(opts metav1.ListOptions) (watch.Interface, error) {
Resource("zfsvolumes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a zFSVolume and creates it. Returns the server's representation of the zFSVolume, and an error, if there is any.
func (c *zFSVolumes) Create(zFSVolume *v1.ZFSVolume) (result *v1.ZFSVolume, err error) {
func (c *zFSVolumes) Create(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.CreateOptions) (result *v1.ZFSVolume, err error) {
result = &v1.ZFSVolume{}
err = c.client.Post().
Namespace(c.ns).
Resource("zfsvolumes").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSVolume).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a zFSVolume and updates it. Returns the server's representation of the zFSVolume, and an error, if there is any.
func (c *zFSVolumes) Update(zFSVolume *v1.ZFSVolume) (result *v1.ZFSVolume, err error) {
func (c *zFSVolumes) Update(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (result *v1.ZFSVolume, err error) {
result = &v1.ZFSVolume{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsvolumes").
Name(zFSVolume.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSVolume).
Do().
Do(ctx).
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 *zFSVolumes) UpdateStatus(zFSVolume *v1.ZFSVolume) (result *v1.ZFSVolume, err error) {
func (c *zFSVolumes) UpdateStatus(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (result *v1.ZFSVolume, err error) {
result = &v1.ZFSVolume{}
err = c.client.Put().
Namespace(c.ns).
Resource("zfsvolumes").
Name(zFSVolume.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(zFSVolume).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the zFSVolume and deletes it. Returns an error if one occurs.
func (c *zFSVolumes) Delete(name string, options *metav1.DeleteOptions) error {
func (c *zFSVolumes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("zfsvolumes").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *zFSVolumes) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *zFSVolumes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("zfsvolumes").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched zFSVolume.
func (c *zFSVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ZFSVolume, err error) {
func (c *zFSVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSVolume, err error) {
result = &v1.ZFSVolume{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("zfsvolumes").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
time "time"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -61,13 +62,13 @@ func NewFilteredZFSBackupInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSBackups(namespace).List(options)
return client.ZfsV1().ZFSBackups(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSBackups(namespace).Watch(options)
return client.ZfsV1().ZFSBackups(namespace).Watch(context.TODO(), options)
},
},
&zfsv1.ZFSBackup{},

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
time "time"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -61,13 +62,13 @@ func NewFilteredZFSRestoreInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSRestores(namespace).List(options)
return client.ZfsV1().ZFSRestores(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSRestores(namespace).Watch(options)
return client.ZfsV1().ZFSRestores(namespace).Watch(context.TODO(), options)
},
},
&zfsv1.ZFSRestore{},

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
time "time"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -61,13 +62,13 @@ func NewFilteredZFSSnapshotInformer(client internalclientset.Interface, namespac
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSSnapshots(namespace).List(options)
return client.ZfsV1().ZFSSnapshots(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSSnapshots(namespace).Watch(options)
return client.ZfsV1().ZFSSnapshots(namespace).Watch(context.TODO(), options)
},
},
&zfsv1.ZFSSnapshot{},

View file

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
"context"
time "time"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
@ -61,13 +62,13 @@ func NewFilteredZFSVolumeInformer(client internalclientset.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSVolumes(namespace).List(options)
return client.ZfsV1().ZFSVolumes(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ZfsV1().ZFSVolumes(namespace).Watch(options)
return client.ZfsV1().ZFSVolumes(namespace).Watch(context.TODO(), options)
},
},
&zfsv1.ZFSVolume{},

View file

@ -26,8 +26,10 @@ import (
)
// ZFSBackupLister helps list ZFSBackups.
// All objects returned here must be treated as read-only.
type ZFSBackupLister interface {
// List lists all ZFSBackups in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSBackup, err error)
// ZFSBackups returns an object that can list and get ZFSBackups.
ZFSBackups(namespace string) ZFSBackupNamespaceLister
@ -58,10 +60,13 @@ func (s *zFSBackupLister) ZFSBackups(namespace string) ZFSBackupNamespaceLister
}
// ZFSBackupNamespaceLister helps list and get ZFSBackups.
// All objects returned here must be treated as read-only.
type ZFSBackupNamespaceLister interface {
// List lists all ZFSBackups in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSBackup, err error)
// Get retrieves the ZFSBackup from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ZFSBackup, error)
ZFSBackupNamespaceListerExpansion
}

View file

@ -26,8 +26,10 @@ import (
)
// ZFSRestoreLister helps list ZFSRestores.
// All objects returned here must be treated as read-only.
type ZFSRestoreLister interface {
// List lists all ZFSRestores in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSRestore, err error)
// ZFSRestores returns an object that can list and get ZFSRestores.
ZFSRestores(namespace string) ZFSRestoreNamespaceLister
@ -58,10 +60,13 @@ func (s *zFSRestoreLister) ZFSRestores(namespace string) ZFSRestoreNamespaceList
}
// ZFSRestoreNamespaceLister helps list and get ZFSRestores.
// All objects returned here must be treated as read-only.
type ZFSRestoreNamespaceLister interface {
// List lists all ZFSRestores in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSRestore, err error)
// Get retrieves the ZFSRestore from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ZFSRestore, error)
ZFSRestoreNamespaceListerExpansion
}

View file

@ -26,8 +26,10 @@ import (
)
// ZFSSnapshotLister helps list ZFSSnapshots.
// All objects returned here must be treated as read-only.
type ZFSSnapshotLister interface {
// List lists all ZFSSnapshots in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSSnapshot, err error)
// ZFSSnapshots returns an object that can list and get ZFSSnapshots.
ZFSSnapshots(namespace string) ZFSSnapshotNamespaceLister
@ -58,10 +60,13 @@ func (s *zFSSnapshotLister) ZFSSnapshots(namespace string) ZFSSnapshotNamespaceL
}
// ZFSSnapshotNamespaceLister helps list and get ZFSSnapshots.
// All objects returned here must be treated as read-only.
type ZFSSnapshotNamespaceLister interface {
// List lists all ZFSSnapshots in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSSnapshot, err error)
// Get retrieves the ZFSSnapshot from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ZFSSnapshot, error)
ZFSSnapshotNamespaceListerExpansion
}

View file

@ -26,8 +26,10 @@ import (
)
// ZFSVolumeLister helps list ZFSVolumes.
// All objects returned here must be treated as read-only.
type ZFSVolumeLister interface {
// List lists all ZFSVolumes in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSVolume, err error)
// ZFSVolumes returns an object that can list and get ZFSVolumes.
ZFSVolumes(namespace string) ZFSVolumeNamespaceLister
@ -58,10 +60,13 @@ func (s *zFSVolumeLister) ZFSVolumes(namespace string) ZFSVolumeNamespaceLister
}
// ZFSVolumeNamespaceLister helps list and get ZFSVolumes.
// All objects returned here must be treated as read-only.
type ZFSVolumeNamespaceLister interface {
// List lists all ZFSVolumes in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ZFSVolume, err error)
// Get retrieves the ZFSVolume from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ZFSVolume, error)
ZFSVolumeNamespaceListerExpansion
}

View file

@ -25,7 +25,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
utilexec "k8s.io/utils/exec"
"k8s.io/utils/mount"
)
// MountInfo contains the volume related info
@ -51,7 +52,7 @@ type MountInfo struct {
// FormatAndMountZvol formats and mounts the created volume to the desired mount path
func FormatAndMountZvol(devicePath string, mountInfo *MountInfo) error {
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
err := mounter.FormatAndMount(devicePath, mountInfo.MountPath, mountInfo.FSType, mountInfo.MountOptions)
if err != nil {
@ -68,7 +69,7 @@ func FormatAndMountZvol(devicePath string, mountInfo *MountInfo) error {
// UmountVolume unmounts the volume and the corresponding mount path is removed
func UmountVolume(vol *apis.ZFSVolume, targetPath string,
) error {
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
dev, ref, err := mount.GetDeviceNameFromMount(mounter, targetPath)
if err != nil {
@ -274,10 +275,10 @@ func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error {
devicePath := ZFSDevPath + vol.Spec.PoolName + "/" + vol.Name
mountopt := []string{"bind"}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: mount.NewOsExec()}
mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()}
// Create the mount point as a file since bind mount device node requires it to be a file
err := mounter.MakeFile(target)
err := makeFile(target)
if err != nil {
return status.Errorf(codes.Internal, "Could not create target file %q: %v", target, err)
}
@ -294,3 +295,14 @@ func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error {
return nil
}
func makeFile(pathname string) error {
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
defer f.Close()
if err != nil {
if !os.IsExist(err) {
return err
}
}
return nil
}

View file

@ -21,7 +21,7 @@ import (
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/utils/mount"
)
// ResizeExtn can be used to run a resize command on the ext2/3/4 filesystem