feat(deps): update deps (#445)

- use minikube v1.26.1 across all github actions workflows
- bring all go module dependencies up to date with openebs/lvm-localpv
- replace github.com/golang/protobuf with google.golang.org/protobuf
- remove go mod vendor Makefile target

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
This commit is contained in:
Niladri Halder 2023-05-29 00:40:10 +05:30 committed by GitHub
parent c0343d0480
commit 4b059dbfaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 446 additions and 596 deletions

View file

@ -20,6 +20,7 @@ package internalclientset
import (
"fmt"
"net/http"
zfsv1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1"
discovery "k8s.io/client-go/discovery"
@ -32,8 +33,7 @@ type Interface interface {
ZfsV1() zfsv1.ZfsV1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
// Clientset contains the clients for groups.
type Clientset struct {
*discovery.DiscoveryClient
zfsV1 *zfsv1.ZfsV1Client
@ -55,22 +55,45 @@ 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.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.UserAgent == "" {
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
}
// share the transport between all clients
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&configShallowCopy, httpClient)
}
// NewForConfigAndClient creates a new Clientset for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*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
var err error
cs.zfsV1, err = zfsv1.NewForConfig(&configShallowCopy)
cs.zfsV1, err = zfsv1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
@ -80,11 +103,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.zfsV1 = zfsv1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
cs, err := NewForConfig(c)
if err != nil {
panic(err)
}
return cs
}
// New creates a new Clientset for the given RESTClient.

View file

@ -1,20 +0,0 @@
/*
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.
// This package has the automatically generated clientset.
package internalclientset

View file

@ -74,7 +74,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
var (
_ clientset.Interface = &Clientset{}
_ testing.FakeClient = &Clientset{}
)
// ZfsV1 retrieves the ZfsV1Client
func (c *Clientset) ZfsV1() zfsv1.ZfsV1Interface {

View file

@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.

View file

@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.

View file

@ -21,10 +21,9 @@ package fake
import (
"context"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
metav1 "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"
@ -36,25 +35,25 @@ type FakeZFSBackups struct {
ns string
}
var zfsbackupsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsbackups"}
var zfsbackupsResource = v1.SchemeGroupVersion.WithResource("zfsbackups")
var zfsbackupsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSBackup"}
var zfsbackupsKind = v1.SchemeGroupVersion.WithKind("ZFSBackup")
// Get takes name of the zFSBackup, and returns the corresponding zFSBackup object, and an error if there is any.
func (c *FakeZFSBackups) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSBackup, err error) {
func (c *FakeZFSBackups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
Invokes(testing.NewGetAction(zfsbackupsResource, c.ns, name), &v1.ZFSBackup{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSBackup), err
return obj.(*v1.ZFSBackup), err
}
// List takes label and field selectors, and returns the list of ZFSBackups that match those selectors.
func (c *FakeZFSBackups) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSBackupList, err error) {
func (c *FakeZFSBackups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSBackupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsbackupsResource, zfsbackupsKind, c.ns, opts), &zfsv1.ZFSBackupList{})
Invokes(testing.NewListAction(zfsbackupsResource, zfsbackupsKind, c.ns, opts), &v1.ZFSBackupList{})
if obj == nil {
return nil, err
@ -64,8 +63,8 @@ func (c *FakeZFSBackups) List(ctx context.Context, opts v1.ListOptions) (result
if label == nil {
label = labels.Everything()
}
list := &zfsv1.ZFSBackupList{ListMeta: obj.(*zfsv1.ZFSBackupList).ListMeta}
for _, item := range obj.(*zfsv1.ZFSBackupList).Items {
list := &v1.ZFSBackupList{ListMeta: obj.(*v1.ZFSBackupList).ListMeta}
for _, item := range obj.(*v1.ZFSBackupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -74,69 +73,69 @@ func (c *FakeZFSBackups) List(ctx context.Context, opts v1.ListOptions) (result
}
// Watch returns a watch.Interface that watches the requested zFSBackups.
func (c *FakeZFSBackups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSBackups) Watch(ctx context.Context, opts metav1.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(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.CreateOptions) (result *zfsv1.ZFSBackup, err error) {
func (c *FakeZFSBackups) Create(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.CreateOptions) (result *v1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
Invokes(testing.NewCreateAction(zfsbackupsResource, c.ns, zFSBackup), &v1.ZFSBackup{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSBackup), err
return obj.(*v1.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(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.UpdateOptions) (result *zfsv1.ZFSBackup, err error) {
func (c *FakeZFSBackups) Update(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (result *v1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsbackupsResource, c.ns, zFSBackup), &zfsv1.ZFSBackup{})
Invokes(testing.NewUpdateAction(zfsbackupsResource, c.ns, zFSBackup), &v1.ZFSBackup{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSBackup), err
return obj.(*v1.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(ctx context.Context, zFSBackup *zfsv1.ZFSBackup, opts v1.UpdateOptions) (*zfsv1.ZFSBackup, error) {
func (c *FakeZFSBackups) UpdateStatus(ctx context.Context, zFSBackup *v1.ZFSBackup, opts metav1.UpdateOptions) (*v1.ZFSBackup, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, "status", c.ns, zFSBackup), &zfsv1.ZFSBackup{})
Invokes(testing.NewUpdateSubresourceAction(zfsbackupsResource, "status", c.ns, zFSBackup), &v1.ZFSBackup{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSBackup), err
return obj.(*v1.ZFSBackup), err
}
// Delete takes name of the zFSBackup and deletes it. Returns an error if one occurs.
func (c *FakeZFSBackups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
func (c *FakeZFSBackups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsbackupsResource, c.ns, name), &zfsv1.ZFSBackup{})
Invokes(testing.NewDeleteActionWithOptions(zfsbackupsResource, c.ns, name, opts), &v1.ZFSBackup{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
func (c *FakeZFSBackups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsbackupsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSBackupList{})
_, err := c.Fake.Invokes(action, &v1.ZFSBackupList{})
return err
}
// Patch applies the patch and returns the patched zFSBackup.
func (c *FakeZFSBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSBackup, err error) {
func (c *FakeZFSBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsbackupsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSBackup{})
Invokes(testing.NewPatchSubresourceAction(zfsbackupsResource, c.ns, name, pt, data, subresources...), &v1.ZFSBackup{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSBackup), err
return obj.(*v1.ZFSBackup), err
}

View file

@ -21,10 +21,9 @@ package fake
import (
"context"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
metav1 "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"
@ -36,25 +35,25 @@ type FakeZFSNodes struct {
ns string
}
var zfsnodesResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsnodes"}
var zfsnodesResource = v1.SchemeGroupVersion.WithResource("zfsnodes")
var zfsnodesKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSNode"}
var zfsnodesKind = v1.SchemeGroupVersion.WithKind("ZFSNode")
// Get takes name of the zFSNode, and returns the corresponding zFSNode object, and an error if there is any.
func (c *FakeZFSNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSNode, err error) {
func (c *FakeZFSNodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSNode, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsnodesResource, c.ns, name), &zfsv1.ZFSNode{})
Invokes(testing.NewGetAction(zfsnodesResource, c.ns, name), &v1.ZFSNode{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSNode), err
return obj.(*v1.ZFSNode), err
}
// List takes label and field selectors, and returns the list of ZFSNodes that match those selectors.
func (c *FakeZFSNodes) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSNodeList, err error) {
func (c *FakeZFSNodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSNodeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsnodesResource, zfsnodesKind, c.ns, opts), &zfsv1.ZFSNodeList{})
Invokes(testing.NewListAction(zfsnodesResource, zfsnodesKind, c.ns, opts), &v1.ZFSNodeList{})
if obj == nil {
return nil, err
@ -64,8 +63,8 @@ func (c *FakeZFSNodes) List(ctx context.Context, opts v1.ListOptions) (result *z
if label == nil {
label = labels.Everything()
}
list := &zfsv1.ZFSNodeList{ListMeta: obj.(*zfsv1.ZFSNodeList).ListMeta}
for _, item := range obj.(*zfsv1.ZFSNodeList).Items {
list := &v1.ZFSNodeList{ListMeta: obj.(*v1.ZFSNodeList).ListMeta}
for _, item := range obj.(*v1.ZFSNodeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -74,57 +73,57 @@ func (c *FakeZFSNodes) List(ctx context.Context, opts v1.ListOptions) (result *z
}
// Watch returns a watch.Interface that watches the requested zFSNodes.
func (c *FakeZFSNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSNodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(zfsnodesResource, c.ns, opts))
}
// Create takes the representation of a zFSNode and creates it. Returns the server's representation of the zFSNode, and an error, if there is any.
func (c *FakeZFSNodes) Create(ctx context.Context, zFSNode *zfsv1.ZFSNode, opts v1.CreateOptions) (result *zfsv1.ZFSNode, err error) {
func (c *FakeZFSNodes) Create(ctx context.Context, zFSNode *v1.ZFSNode, opts metav1.CreateOptions) (result *v1.ZFSNode, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsnodesResource, c.ns, zFSNode), &zfsv1.ZFSNode{})
Invokes(testing.NewCreateAction(zfsnodesResource, c.ns, zFSNode), &v1.ZFSNode{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSNode), err
return obj.(*v1.ZFSNode), err
}
// Update takes the representation of a zFSNode and updates it. Returns the server's representation of the zFSNode, and an error, if there is any.
func (c *FakeZFSNodes) Update(ctx context.Context, zFSNode *zfsv1.ZFSNode, opts v1.UpdateOptions) (result *zfsv1.ZFSNode, err error) {
func (c *FakeZFSNodes) Update(ctx context.Context, zFSNode *v1.ZFSNode, opts metav1.UpdateOptions) (result *v1.ZFSNode, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsnodesResource, c.ns, zFSNode), &zfsv1.ZFSNode{})
Invokes(testing.NewUpdateAction(zfsnodesResource, c.ns, zFSNode), &v1.ZFSNode{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSNode), err
return obj.(*v1.ZFSNode), err
}
// Delete takes name of the zFSNode and deletes it. Returns an error if one occurs.
func (c *FakeZFSNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
func (c *FakeZFSNodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsnodesResource, c.ns, name), &zfsv1.ZFSNode{})
Invokes(testing.NewDeleteActionWithOptions(zfsnodesResource, c.ns, name, opts), &v1.ZFSNode{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
func (c *FakeZFSNodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsnodesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSNodeList{})
_, err := c.Fake.Invokes(action, &v1.ZFSNodeList{})
return err
}
// Patch applies the patch and returns the patched zFSNode.
func (c *FakeZFSNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSNode, err error) {
func (c *FakeZFSNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSNode, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsnodesResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSNode{})
Invokes(testing.NewPatchSubresourceAction(zfsnodesResource, c.ns, name, pt, data, subresources...), &v1.ZFSNode{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSNode), err
return obj.(*v1.ZFSNode), err
}

View file

@ -21,10 +21,9 @@ package fake
import (
"context"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
metav1 "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"
@ -36,25 +35,25 @@ type FakeZFSRestores struct {
ns string
}
var zfsrestoresResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsrestores"}
var zfsrestoresResource = v1.SchemeGroupVersion.WithResource("zfsrestores")
var zfsrestoresKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSRestore"}
var zfsrestoresKind = v1.SchemeGroupVersion.WithKind("ZFSRestore")
// Get takes name of the zFSRestore, and returns the corresponding zFSRestore object, and an error if there is any.
func (c *FakeZFSRestores) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSRestore, err error) {
func (c *FakeZFSRestores) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
Invokes(testing.NewGetAction(zfsrestoresResource, c.ns, name), &v1.ZFSRestore{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSRestore), err
return obj.(*v1.ZFSRestore), err
}
// List takes label and field selectors, and returns the list of ZFSRestores that match those selectors.
func (c *FakeZFSRestores) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSRestoreList, err error) {
func (c *FakeZFSRestores) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSRestoreList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsrestoresResource, zfsrestoresKind, c.ns, opts), &zfsv1.ZFSRestoreList{})
Invokes(testing.NewListAction(zfsrestoresResource, zfsrestoresKind, c.ns, opts), &v1.ZFSRestoreList{})
if obj == nil {
return nil, err
@ -64,8 +63,8 @@ func (c *FakeZFSRestores) List(ctx context.Context, opts v1.ListOptions) (result
if label == nil {
label = labels.Everything()
}
list := &zfsv1.ZFSRestoreList{ListMeta: obj.(*zfsv1.ZFSRestoreList).ListMeta}
for _, item := range obj.(*zfsv1.ZFSRestoreList).Items {
list := &v1.ZFSRestoreList{ListMeta: obj.(*v1.ZFSRestoreList).ListMeta}
for _, item := range obj.(*v1.ZFSRestoreList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -74,69 +73,69 @@ func (c *FakeZFSRestores) List(ctx context.Context, opts v1.ListOptions) (result
}
// Watch returns a watch.Interface that watches the requested zFSRestores.
func (c *FakeZFSRestores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSRestores) Watch(ctx context.Context, opts metav1.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(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.CreateOptions) (result *zfsv1.ZFSRestore, err error) {
func (c *FakeZFSRestores) Create(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.CreateOptions) (result *v1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
Invokes(testing.NewCreateAction(zfsrestoresResource, c.ns, zFSRestore), &v1.ZFSRestore{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSRestore), err
return obj.(*v1.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(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.UpdateOptions) (result *zfsv1.ZFSRestore, err error) {
func (c *FakeZFSRestores) Update(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (result *v1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsrestoresResource, c.ns, zFSRestore), &zfsv1.ZFSRestore{})
Invokes(testing.NewUpdateAction(zfsrestoresResource, c.ns, zFSRestore), &v1.ZFSRestore{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSRestore), err
return obj.(*v1.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(ctx context.Context, zFSRestore *zfsv1.ZFSRestore, opts v1.UpdateOptions) (*zfsv1.ZFSRestore, error) {
func (c *FakeZFSRestores) UpdateStatus(ctx context.Context, zFSRestore *v1.ZFSRestore, opts metav1.UpdateOptions) (*v1.ZFSRestore, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsrestoresResource, "status", c.ns, zFSRestore), &zfsv1.ZFSRestore{})
Invokes(testing.NewUpdateSubresourceAction(zfsrestoresResource, "status", c.ns, zFSRestore), &v1.ZFSRestore{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSRestore), err
return obj.(*v1.ZFSRestore), err
}
// Delete takes name of the zFSRestore and deletes it. Returns an error if one occurs.
func (c *FakeZFSRestores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
func (c *FakeZFSRestores) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsrestoresResource, c.ns, name), &zfsv1.ZFSRestore{})
Invokes(testing.NewDeleteActionWithOptions(zfsrestoresResource, c.ns, name, opts), &v1.ZFSRestore{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSRestores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
func (c *FakeZFSRestores) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsrestoresResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSRestoreList{})
_, err := c.Fake.Invokes(action, &v1.ZFSRestoreList{})
return err
}
// Patch applies the patch and returns the patched zFSRestore.
func (c *FakeZFSRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSRestore, err error) {
func (c *FakeZFSRestores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSRestore, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsrestoresResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSRestore{})
Invokes(testing.NewPatchSubresourceAction(zfsrestoresResource, c.ns, name, pt, data, subresources...), &v1.ZFSRestore{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSRestore), err
return obj.(*v1.ZFSRestore), err
}

View file

@ -21,10 +21,9 @@ package fake
import (
"context"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
metav1 "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"
@ -36,25 +35,25 @@ type FakeZFSSnapshots struct {
ns string
}
var zfssnapshotsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfssnapshots"}
var zfssnapshotsResource = v1.SchemeGroupVersion.WithResource("zfssnapshots")
var zfssnapshotsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSSnapshot"}
var zfssnapshotsKind = v1.SchemeGroupVersion.WithKind("ZFSSnapshot")
// Get takes name of the zFSSnapshot, and returns the corresponding zFSSnapshot object, and an error if there is any.
func (c *FakeZFSSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfssnapshotsResource, c.ns, name), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewGetAction(zfssnapshotsResource, c.ns, name), &v1.ZFSSnapshot{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSSnapshot), err
return obj.(*v1.ZFSSnapshot), err
}
// List takes label and field selectors, and returns the list of ZFSSnapshots that match those selectors.
func (c *FakeZFSSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSSnapshotList, err error) {
func (c *FakeZFSSnapshots) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSSnapshotList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfssnapshotsResource, zfssnapshotsKind, c.ns, opts), &zfsv1.ZFSSnapshotList{})
Invokes(testing.NewListAction(zfssnapshotsResource, zfssnapshotsKind, c.ns, opts), &v1.ZFSSnapshotList{})
if obj == nil {
return nil, err
@ -64,8 +63,8 @@ func (c *FakeZFSSnapshots) List(ctx context.Context, opts v1.ListOptions) (resul
if label == nil {
label = labels.Everything()
}
list := &zfsv1.ZFSSnapshotList{ListMeta: obj.(*zfsv1.ZFSSnapshotList).ListMeta}
for _, item := range obj.(*zfsv1.ZFSSnapshotList).Items {
list := &v1.ZFSSnapshotList{ListMeta: obj.(*v1.ZFSSnapshotList).ListMeta}
for _, item := range obj.(*v1.ZFSSnapshotList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -74,69 +73,69 @@ func (c *FakeZFSSnapshots) List(ctx context.Context, opts v1.ListOptions) (resul
}
// Watch returns a watch.Interface that watches the requested zFSSnapshots.
func (c *FakeZFSSnapshots) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSSnapshots) Watch(ctx context.Context, opts metav1.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(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.CreateOptions) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Create(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.CreateOptions) (result *v1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewCreateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &v1.ZFSSnapshot{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSSnapshot), err
return obj.(*v1.ZFSSnapshot), err
}
// 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(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.UpdateOptions) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Update(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (result *v1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewUpdateAction(zfssnapshotsResource, c.ns, zFSSnapshot), &v1.ZFSSnapshot{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSSnapshot), err
return obj.(*v1.ZFSSnapshot), 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 *FakeZFSSnapshots) UpdateStatus(ctx context.Context, zFSSnapshot *zfsv1.ZFSSnapshot, opts v1.UpdateOptions) (*zfsv1.ZFSSnapshot, error) {
func (c *FakeZFSSnapshots) UpdateStatus(ctx context.Context, zFSSnapshot *v1.ZFSSnapshot, opts metav1.UpdateOptions) (*v1.ZFSSnapshot, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfssnapshotsResource, "status", c.ns, zFSSnapshot), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewUpdateSubresourceAction(zfssnapshotsResource, "status", c.ns, zFSSnapshot), &v1.ZFSSnapshot{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSSnapshot), err
return obj.(*v1.ZFSSnapshot), err
}
// Delete takes name of the zFSSnapshot and deletes it. Returns an error if one occurs.
func (c *FakeZFSSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
func (c *FakeZFSSnapshots) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfssnapshotsResource, c.ns, name), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewDeleteActionWithOptions(zfssnapshotsResource, c.ns, name, opts), &v1.ZFSSnapshot{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
func (c *FakeZFSSnapshots) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfssnapshotsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSSnapshotList{})
_, err := c.Fake.Invokes(action, &v1.ZFSSnapshotList{})
return err
}
// Patch applies the patch and returns the patched zFSSnapshot.
func (c *FakeZFSSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSSnapshot, err error) {
func (c *FakeZFSSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSSnapshot, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfssnapshotsResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSSnapshot{})
Invokes(testing.NewPatchSubresourceAction(zfssnapshotsResource, c.ns, name, pt, data, subresources...), &v1.ZFSSnapshot{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSSnapshot), err
return obj.(*v1.ZFSSnapshot), err
}

View file

@ -21,10 +21,9 @@ package fake
import (
"context"
zfsv1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
metav1 "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"
@ -36,25 +35,25 @@ type FakeZFSVolumes struct {
ns string
}
var zfsvolumesResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1", Resource: "zfsvolumes"}
var zfsvolumesResource = v1.SchemeGroupVersion.WithResource("zfsvolumes")
var zfsvolumesKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1", Kind: "ZFSVolume"}
var zfsvolumesKind = v1.SchemeGroupVersion.WithKind("ZFSVolume")
// Get takes name of the zFSVolume, and returns the corresponding zFSVolume object, and an error if there is any.
func (c *FakeZFSVolumes) Get(ctx context.Context, name string, options v1.GetOptions) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(zfsvolumesResource, c.ns, name), &zfsv1.ZFSVolume{})
Invokes(testing.NewGetAction(zfsvolumesResource, c.ns, name), &v1.ZFSVolume{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSVolume), err
return obj.(*v1.ZFSVolume), err
}
// List takes label and field selectors, and returns the list of ZFSVolumes that match those selectors.
func (c *FakeZFSVolumes) List(ctx context.Context, opts v1.ListOptions) (result *zfsv1.ZFSVolumeList, err error) {
func (c *FakeZFSVolumes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ZFSVolumeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(zfsvolumesResource, zfsvolumesKind, c.ns, opts), &zfsv1.ZFSVolumeList{})
Invokes(testing.NewListAction(zfsvolumesResource, zfsvolumesKind, c.ns, opts), &v1.ZFSVolumeList{})
if obj == nil {
return nil, err
@ -64,8 +63,8 @@ func (c *FakeZFSVolumes) List(ctx context.Context, opts v1.ListOptions) (result
if label == nil {
label = labels.Everything()
}
list := &zfsv1.ZFSVolumeList{ListMeta: obj.(*zfsv1.ZFSVolumeList).ListMeta}
for _, item := range obj.(*zfsv1.ZFSVolumeList).Items {
list := &v1.ZFSVolumeList{ListMeta: obj.(*v1.ZFSVolumeList).ListMeta}
for _, item := range obj.(*v1.ZFSVolumeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -74,69 +73,69 @@ func (c *FakeZFSVolumes) List(ctx context.Context, opts v1.ListOptions) (result
}
// Watch returns a watch.Interface that watches the requested zFSVolumes.
func (c *FakeZFSVolumes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeZFSVolumes) Watch(ctx context.Context, opts metav1.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(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.CreateOptions) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Create(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.CreateOptions) (result *v1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(zfsvolumesResource, c.ns, zFSVolume), &zfsv1.ZFSVolume{})
Invokes(testing.NewCreateAction(zfsvolumesResource, c.ns, zFSVolume), &v1.ZFSVolume{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSVolume), err
return obj.(*v1.ZFSVolume), err
}
// 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(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.UpdateOptions) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Update(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (result *v1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(zfsvolumesResource, c.ns, zFSVolume), &zfsv1.ZFSVolume{})
Invokes(testing.NewUpdateAction(zfsvolumesResource, c.ns, zFSVolume), &v1.ZFSVolume{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSVolume), err
return obj.(*v1.ZFSVolume), 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 *FakeZFSVolumes) UpdateStatus(ctx context.Context, zFSVolume *zfsv1.ZFSVolume, opts v1.UpdateOptions) (*zfsv1.ZFSVolume, error) {
func (c *FakeZFSVolumes) UpdateStatus(ctx context.Context, zFSVolume *v1.ZFSVolume, opts metav1.UpdateOptions) (*v1.ZFSVolume, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(zfsvolumesResource, "status", c.ns, zFSVolume), &zfsv1.ZFSVolume{})
Invokes(testing.NewUpdateSubresourceAction(zfsvolumesResource, "status", c.ns, zFSVolume), &v1.ZFSVolume{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSVolume), err
return obj.(*v1.ZFSVolume), err
}
// Delete takes name of the zFSVolume and deletes it. Returns an error if one occurs.
func (c *FakeZFSVolumes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
func (c *FakeZFSVolumes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(zfsvolumesResource, c.ns, name), &zfsv1.ZFSVolume{})
Invokes(testing.NewDeleteActionWithOptions(zfsvolumesResource, c.ns, name, opts), &v1.ZFSVolume{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeZFSVolumes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
func (c *FakeZFSVolumes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
action := testing.NewDeleteCollectionAction(zfsvolumesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &zfsv1.ZFSVolumeList{})
_, err := c.Fake.Invokes(action, &v1.ZFSVolumeList{})
return err
}
// Patch applies the patch and returns the patched zFSVolume.
func (c *FakeZFSVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zfsv1.ZFSVolume, err error) {
func (c *FakeZFSVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ZFSVolume, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(zfsvolumesResource, c.ns, name, pt, data, subresources...), &zfsv1.ZFSVolume{})
Invokes(testing.NewPatchSubresourceAction(zfsvolumesResource, c.ns, name, pt, data, subresources...), &v1.ZFSVolume{})
if obj == nil {
return nil, err
}
return obj.(*zfsv1.ZFSVolume), err
return obj.(*v1.ZFSVolume), err
}

View file

@ -19,6 +19,8 @@ limitations under the License.
package v1
import (
"net/http"
v1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
"github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/scheme"
rest "k8s.io/client-go/rest"
@ -59,12 +61,28 @@ func (c *ZfsV1Client) ZFSVolumes(namespace string) ZFSVolumeInterface {
}
// NewForConfig creates a new ZfsV1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*ZfsV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
httpClient, err := rest.HTTPClientFor(&config)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new ZfsV1Client for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ZfsV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientForConfigAndClient(&config, h)
if err != nil {
return nil, err
}

View file

@ -47,6 +47,11 @@ type sharedInformerFactory struct {
// startedInformers is used for tracking which informers have been started.
// This allows Start() to be called multiple times safely.
startedInformers map[reflect.Type]bool
// wg tracks how many goroutines were started.
wg sync.WaitGroup
// shuttingDown is true when Shutdown has been called. It may still be running
// because it needs to wait for goroutines.
shuttingDown bool
}
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
@ -107,20 +112,39 @@ func NewSharedInformerFactoryWithOptions(client internalclientset.Interface, def
return factory
}
// Start initializes all requested informers.
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
f.lock.Lock()
defer f.lock.Unlock()
if f.shuttingDown {
return
}
for informerType, informer := range f.informers {
if !f.startedInformers[informerType] {
go informer.Run(stopCh)
f.wg.Add(1)
// We need a new variable in each loop iteration,
// otherwise the goroutine would use the loop variable
// and that keeps changing.
informer := informer
go func() {
defer f.wg.Done()
informer.Run(stopCh)
}()
f.startedInformers[informerType] = true
}
}
}
// WaitForCacheSync waits for all started informers' cache were synced.
func (f *sharedInformerFactory) Shutdown() {
f.lock.Lock()
f.shuttingDown = true
f.lock.Unlock()
// Will return immediately if there is nothing to wait for.
f.wg.Wait()
}
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
informers := func() map[reflect.Type]cache.SharedIndexInformer {
f.lock.Lock()
@ -167,11 +191,58 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
// SharedInformerFactory provides shared informers for resources in all known
// API group versions.
//
// It is typically used like this:
//
// ctx, cancel := context.Background()
// defer cancel()
// factory := NewSharedInformerFactory(client, resyncPeriod)
// defer factory.WaitForStop() // Returns immediately if nothing was started.
// genericInformer := factory.ForResource(resource)
// typedInformer := factory.SomeAPIGroup().V1().SomeType()
// factory.Start(ctx.Done()) // Start processing these informers.
// synced := factory.WaitForCacheSync(ctx.Done())
// for v, ok := range synced {
// if !ok {
// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v)
// return
// }
// }
//
// // Creating informers can also be created after Start, but then
// // Start must be called again:
// anotherGenericInformer := factory.ForResource(resource)
// factory.Start(ctx.Done())
type SharedInformerFactory interface {
internalinterfaces.SharedInformerFactory
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
// Start initializes all requested informers. They are handled in goroutines
// which run until the stop channel gets closed.
Start(stopCh <-chan struct{})
// Shutdown marks a factory as shutting down. At that point no new
// informers can be started anymore and Start will return without
// doing anything.
//
// In addition, Shutdown blocks until all goroutines have terminated. For that
// to happen, the close channel(s) that they were started with must be closed,
// either before Shutdown gets called or while it is waiting.
//
// Shutdown may be called multiple times, even concurrently. All such calls will
// block until all goroutines have terminated.
Shutdown()
// WaitForCacheSync blocks until all started informers' caches were synced
// or the stop channel gets closed.
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
// ForResource gives generic access to a shared informer of the matching type.
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
// client.
InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer
Zfs() zfs.Interface
}