Deal with auto-generated files

Signed-off-by: RainbowMango <renhongcai@huawei.com>
This commit is contained in:
RainbowMango 2021-03-06 16:23:20 +08:00 committed by Hongcai Ren
parent 39813bdf31
commit baf0faee9e
13 changed files with 565 additions and 0 deletions

View File

@ -0,0 +1,96 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: clusterresourcebindings.work.karmada.io
spec:
group: work.karmada.io
names:
kind: ClusterResourceBinding
listKind: ClusterResourceBindingList
plural: clusterresourcebindings
singular: clusterresourcebinding
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ClusterResourceBinding represents a binding of a kubernetes resource
with a ClusterPropagationPolicy.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the desired behavior.
properties:
clusters:
description: Clusters represents target member clusters where the
resource to be deployed.
items:
description: TargetCluster represents the identifier of a member
cluster.
properties:
name:
description: Name of target cluster.
type: string
required:
- name
type: object
type: array
resource:
description: Resource represents the Kubernetes resource to be propagated.
properties:
apiVersion:
description: APIVersion represents the API version of the referent.
type: string
kind:
description: Kind represents the Kind of the referent.
type: string
name:
description: Name represents the name of the referent.
type: string
namespace:
description: Namespace represents the namespace for the referent.
For non-namespace scoped resources(e.g. 'ClusterRole')do not
need specify Namespace, and for namespace scoped resources,
Namespace is required. If Namespace is not specified, means
the resource is non-namespace scoped.
type: string
resourceVersion:
description: ResourceVersion represents the internal version of
the referenced object, that can be used by clients to determine
when object has changed.
type: string
required:
- apiVersion
- kind
- name
type: object
required:
- resource
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -26,6 +26,66 @@ func (in *AggregatedStatusItem) DeepCopy() *AggregatedStatusItem {
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterResourceBinding) DeepCopyInto(out *ClusterResourceBinding) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceBinding.
func (in *ClusterResourceBinding) DeepCopy() *ClusterResourceBinding {
if in == nil {
return nil
}
out := new(ClusterResourceBinding)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterResourceBinding) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterResourceBindingList) DeepCopyInto(out *ClusterResourceBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterResourceBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceBindingList.
func (in *ClusterResourceBindingList) DeepCopy() *ClusterResourceBindingList {
if in == nil {
return nil
}
out := new(ClusterResourceBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterResourceBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) {
*out = *in *out = *in

View File

@ -42,6 +42,8 @@ func init() {
// Adds the list of known types to Scheme. // Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error { func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion, scheme.AddKnownTypes(SchemeGroupVersion,
&ClusterResourceBinding{},
&ClusterResourceBindingList{},
&ResourceBinding{}, &ResourceBinding{},
&ResourceBindingList{}, &ResourceBindingList{},
&Work{}, &Work{},

View File

@ -0,0 +1,152 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClusterResourceBindingsGetter has a method to return a ClusterResourceBindingInterface.
// A group's client should implement this interface.
type ClusterResourceBindingsGetter interface {
ClusterResourceBindings() ClusterResourceBindingInterface
}
// ClusterResourceBindingInterface has methods to work with ClusterResourceBinding resources.
type ClusterResourceBindingInterface interface {
Create(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.CreateOptions) (*v1alpha1.ClusterResourceBinding, error)
Update(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (*v1alpha1.ClusterResourceBinding, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterResourceBinding, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterResourceBindingList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterResourceBinding, err error)
ClusterResourceBindingExpansion
}
// clusterResourceBindings implements ClusterResourceBindingInterface
type clusterResourceBindings struct {
client rest.Interface
}
// newClusterResourceBindings returns a ClusterResourceBindings
func newClusterResourceBindings(c *WorkV1alpha1Client) *clusterResourceBindings {
return &clusterResourceBindings{
client: c.RESTClient(),
}
}
// Get takes name of the clusterResourceBinding, and returns the corresponding clusterResourceBinding object, and an error if there is any.
func (c *clusterResourceBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
result = &v1alpha1.ClusterResourceBinding{}
err = c.client.Get().
Resource("clusterresourcebindings").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ClusterResourceBindings that match those selectors.
func (c *clusterResourceBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterResourceBindingList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterResourceBindingList{}
err = c.client.Get().
Resource("clusterresourcebindings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterResourceBindings.
func (c *clusterResourceBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("clusterresourcebindings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a clusterResourceBinding and creates it. Returns the server's representation of the clusterResourceBinding, and an error, if there is any.
func (c *clusterResourceBindings) Create(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.CreateOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
result = &v1alpha1.ClusterResourceBinding{}
err = c.client.Post().
Resource("clusterresourcebindings").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterResourceBinding).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a clusterResourceBinding and updates it. Returns the server's representation of the clusterResourceBinding, and an error, if there is any.
func (c *clusterResourceBindings) Update(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
result = &v1alpha1.ClusterResourceBinding{}
err = c.client.Put().
Resource("clusterresourcebindings").
Name(clusterResourceBinding.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterResourceBinding).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterResourceBinding and deletes it. Returns an error if one occurs.
func (c *clusterResourceBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("clusterresourcebindings").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusterResourceBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("clusterresourcebindings").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched clusterResourceBinding.
func (c *clusterResourceBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterResourceBinding, err error) {
result = &v1alpha1.ClusterResourceBinding{}
err = c.client.Patch(pt).
Resource("clusterresourcebindings").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,106 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeClusterResourceBindings implements ClusterResourceBindingInterface
type FakeClusterResourceBindings struct {
Fake *FakeWorkV1alpha1
}
var clusterresourcebindingsResource = schema.GroupVersionResource{Group: "work.karmada.io", Version: "v1alpha1", Resource: "clusterresourcebindings"}
var clusterresourcebindingsKind = schema.GroupVersionKind{Group: "work.karmada.io", Version: "v1alpha1", Kind: "ClusterResourceBinding"}
// Get takes name of the clusterResourceBinding, and returns the corresponding clusterResourceBinding object, and an error if there is any.
func (c *FakeClusterResourceBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(clusterresourcebindingsResource, name), &v1alpha1.ClusterResourceBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterResourceBinding), err
}
// List takes label and field selectors, and returns the list of ClusterResourceBindings that match those selectors.
func (c *FakeClusterResourceBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterResourceBindingList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(clusterresourcebindingsResource, clusterresourcebindingsKind, opts), &v1alpha1.ClusterResourceBindingList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterResourceBindingList{ListMeta: obj.(*v1alpha1.ClusterResourceBindingList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterResourceBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusterResourceBindings.
func (c *FakeClusterResourceBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(clusterresourcebindingsResource, opts))
}
// Create takes the representation of a clusterResourceBinding and creates it. Returns the server's representation of the clusterResourceBinding, and an error, if there is any.
func (c *FakeClusterResourceBindings) Create(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.CreateOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(clusterresourcebindingsResource, clusterResourceBinding), &v1alpha1.ClusterResourceBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterResourceBinding), err
}
// Update takes the representation of a clusterResourceBinding and updates it. Returns the server's representation of the clusterResourceBinding, and an error, if there is any.
func (c *FakeClusterResourceBindings) Update(ctx context.Context, clusterResourceBinding *v1alpha1.ClusterResourceBinding, opts v1.UpdateOptions) (result *v1alpha1.ClusterResourceBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(clusterresourcebindingsResource, clusterResourceBinding), &v1alpha1.ClusterResourceBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterResourceBinding), err
}
// Delete takes name of the clusterResourceBinding and deletes it. Returns an error if one occurs.
func (c *FakeClusterResourceBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(clusterresourcebindingsResource, name), &v1alpha1.ClusterResourceBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterResourceBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(clusterresourcebindingsResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterResourceBindingList{})
return err
}
// Patch applies the patch and returns the patched clusterResourceBinding.
func (c *FakeClusterResourceBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterResourceBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(clusterresourcebindingsResource, name, pt, data, subresources...), &v1alpha1.ClusterResourceBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterResourceBinding), err
}

View File

@ -12,6 +12,10 @@ type FakeWorkV1alpha1 struct {
*testing.Fake *testing.Fake
} }
func (c *FakeWorkV1alpha1) ClusterResourceBindings() v1alpha1.ClusterResourceBindingInterface {
return &FakeClusterResourceBindings{c}
}
func (c *FakeWorkV1alpha1) ResourceBindings(namespace string) v1alpha1.ResourceBindingInterface { func (c *FakeWorkV1alpha1) ResourceBindings(namespace string) v1alpha1.ResourceBindingInterface {
return &FakeResourceBindings{c, namespace} return &FakeResourceBindings{c, namespace}
} }

View File

@ -2,6 +2,8 @@
package v1alpha1 package v1alpha1
type ClusterResourceBindingExpansion interface{}
type ResourceBindingExpansion interface{} type ResourceBindingExpansion interface{}
type WorkExpansion interface{} type WorkExpansion interface{}

View File

@ -10,6 +10,7 @@ import (
type WorkV1alpha1Interface interface { type WorkV1alpha1Interface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
ClusterResourceBindingsGetter
ResourceBindingsGetter ResourceBindingsGetter
WorksGetter WorksGetter
} }
@ -19,6 +20,10 @@ type WorkV1alpha1Client struct {
restClient rest.Interface restClient rest.Interface
} }
func (c *WorkV1alpha1Client) ClusterResourceBindings() ClusterResourceBindingInterface {
return newClusterResourceBindings(c)
}
func (c *WorkV1alpha1Client) ResourceBindings(namespace string) ResourceBindingInterface { func (c *WorkV1alpha1Client) ResourceBindings(namespace string) ResourceBindingInterface {
return newResourceBindings(c, namespace) return newResourceBindings(c, namespace)
} }

View File

@ -53,6 +53,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().PropagationPolicies().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().PropagationPolicies().Informer()}, nil
// Group=work.karmada.io, Version=v1alpha1 // Group=work.karmada.io, Version=v1alpha1
case workv1alpha1.SchemeGroupVersion.WithResource("clusterresourcebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1alpha1().ClusterResourceBindings().Informer()}, nil
case workv1alpha1.SchemeGroupVersion.WithResource("resourcebindings"): case workv1alpha1.SchemeGroupVersion.WithResource("resourcebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1alpha1().ResourceBindings().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1alpha1().ResourceBindings().Informer()}, nil
case workv1alpha1.SchemeGroupVersion.WithResource("works"): case workv1alpha1.SchemeGroupVersion.WithResource("works"):

View File

@ -0,0 +1,73 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/listers/work/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// ClusterResourceBindingInformer provides access to a shared informer and lister for
// ClusterResourceBindings.
type ClusterResourceBindingInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ClusterResourceBindingLister
}
type clusterResourceBindingInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewClusterResourceBindingInformer constructs a new informer for ClusterResourceBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewClusterResourceBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredClusterResourceBindingInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredClusterResourceBindingInformer constructs a new informer for ClusterResourceBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredClusterResourceBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.WorkV1alpha1().ClusterResourceBindings().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.WorkV1alpha1().ClusterResourceBindings().Watch(context.TODO(), options)
},
},
&workv1alpha1.ClusterResourceBinding{},
resyncPeriod,
indexers,
)
}
func (f *clusterResourceBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredClusterResourceBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *clusterResourceBindingInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&workv1alpha1.ClusterResourceBinding{}, f.defaultInformer)
}
func (f *clusterResourceBindingInformer) Lister() v1alpha1.ClusterResourceBindingLister {
return v1alpha1.NewClusterResourceBindingLister(f.Informer().GetIndexer())
}

View File

@ -8,6 +8,8 @@ import (
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// ClusterResourceBindings returns a ClusterResourceBindingInformer.
ClusterResourceBindings() ClusterResourceBindingInformer
// ResourceBindings returns a ResourceBindingInformer. // ResourceBindings returns a ResourceBindingInformer.
ResourceBindings() ResourceBindingInformer ResourceBindings() ResourceBindingInformer
// Works returns a WorkInformer. // Works returns a WorkInformer.
@ -25,6 +27,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} }
// ClusterResourceBindings returns a ClusterResourceBindingInformer.
func (v *version) ClusterResourceBindings() ClusterResourceBindingInformer {
return &clusterResourceBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ResourceBindings returns a ResourceBindingInformer. // ResourceBindings returns a ResourceBindingInformer.
func (v *version) ResourceBindings() ResourceBindingInformer { func (v *version) ResourceBindings() ResourceBindingInformer {
return &resourceBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &resourceBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@ -0,0 +1,52 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ClusterResourceBindingLister helps list ClusterResourceBindings.
// All objects returned here must be treated as read-only.
type ClusterResourceBindingLister interface {
// List lists all ClusterResourceBindings in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.ClusterResourceBinding, err error)
// Get retrieves the ClusterResourceBinding from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.ClusterResourceBinding, error)
ClusterResourceBindingListerExpansion
}
// clusterResourceBindingLister implements the ClusterResourceBindingLister interface.
type clusterResourceBindingLister struct {
indexer cache.Indexer
}
// NewClusterResourceBindingLister returns a new ClusterResourceBindingLister.
func NewClusterResourceBindingLister(indexer cache.Indexer) ClusterResourceBindingLister {
return &clusterResourceBindingLister{indexer: indexer}
}
// List lists all ClusterResourceBindings in the indexer.
func (s *clusterResourceBindingLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterResourceBinding, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ClusterResourceBinding))
})
return ret, err
}
// Get retrieves the ClusterResourceBinding from the index for a given name.
func (s *clusterResourceBindingLister) Get(name string) (*v1alpha1.ClusterResourceBinding, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("clusterresourcebinding"), name)
}
return obj.(*v1alpha1.ClusterResourceBinding), nil
}

View File

@ -2,6 +2,10 @@
package v1alpha1 package v1alpha1
// ClusterResourceBindingListerExpansion allows custom methods to be added to
// ClusterResourceBindingLister.
type ClusterResourceBindingListerExpansion interface{}
// ResourceBindingListerExpansion allows custom methods to be added to // ResourceBindingListerExpansion allows custom methods to be added to
// ResourceBindingLister. // ResourceBindingLister.
type ResourceBindingListerExpansion interface{} type ResourceBindingListerExpansion interface{}