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

@ -75,14 +75,15 @@ jobs:
sudo zpool create zfspv-pool `sudo losetup -f /tmp/disk.img --show`
- name: Set up Go 1.19
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19.9
cache: false
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2
with:
minikube version: v1.30.1
minikube version: 'v1.26.1'
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -74,9 +74,10 @@ jobs:
sudo zpool create zfspv-pool `sudo losetup -f /tmp/disk.img --show`
- name: Set up Go 1.19
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.19.9
cache: false
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2

View file

@ -126,10 +126,6 @@ verify-deps: deps
echo "go module files are out of date, please commit the changes to go.mod and go.sum"; exit 1; \
fi
.PHONY: vendor
vendor: go.mod go.sum deps
@go mod vendor
# Bootstrap downloads tools required
# during build
.PHONY: bootstrap

View file

@ -1,3 +1,4 @@
//go:build tools
// +build tools
/*

47
go.mod
View file

@ -5,9 +5,8 @@ go 1.19
require (
github.com/container-storage-interface/spec v1.8.0
github.com/docker/go-units v0.4.0
github.com/golang/protobuf v1.5.3
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
github.com/kubernetes-csi/csi-lib-utils v0.6.1
github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.7
github.com/openebs/lib-csi v0.7.0
@ -17,6 +16,7 @@ require (
golang.org/x/net v0.10.0
golang.org/x/sys v0.8.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.30.0
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
@ -28,9 +28,11 @@ require (
)
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
@ -38,21 +40,28 @@ require (
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
@ -60,43 +69,23 @@ require (
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/testing_frameworks v0.1.2 // indirect
)
replace (
github.com/container-storage-interface/spec => github.com/container-storage-interface/spec v1.1.0
k8s.io/api => k8s.io/api v0.27.2
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.2
k8s.io/apimachinery => k8s.io/apimachinery v0.27.2
k8s.io/apiserver => k8s.io/apiserver v0.27.2
k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.2
github.com/container-storage-interface/spec => github.com/container-storage-interface/spec v1.2.0
k8s.io/client-go => k8s.io/client-go v0.27.2
k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.2
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.2
k8s.io/code-generator => k8s.io/code-generator v0.27.2
k8s.io/component-base => k8s.io/component-base v0.27.2
k8s.io/cri-api => k8s.io/cri-api v0.27.2
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.2
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.2
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.2
k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.2
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.2
k8s.io/kubectl => k8s.io/kubectl v0.27.2
k8s.io/kubelet => k8s.io/kubelet v0.27.2
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.2
k8s.io/metrics => k8s.io/metrics v0.27.2
k8s.io/node-api => k8s.io/node-api v0.27.2
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.2
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.2
k8s.io/sample-controller => k8s.io/sample-controller v0.27.2
)

508
go.sum

File diff suppressed because it is too large Load diff

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
}

View file

@ -18,7 +18,7 @@ package v1alpha1
import (
"github.com/container-storage-interface/spec/lib/go/csi"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)
// CreateSnapshotResponseBuilder helps building an