diff --git a/api/generated/clientset/versioned/fake/clientset_generated.go b/api/generated/clientset/versioned/fake/clientset_generated.go index 18d2a4f8f..635125b6a 100644 --- a/api/generated/clientset/versioned/fake/clientset_generated.go +++ b/api/generated/clientset/versioned/fake/clientset_generated.go @@ -31,8 +31,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeature.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeature.go index f956c8217..186ce2388 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeature.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeature.go @@ -41,22 +41,24 @@ var nodefeaturesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeFeature") // Get takes name of the nodeFeature, and returns the corresponding nodeFeature object, and an error if there is any. func (c *FakeNodeFeatures) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeature, err error) { + emptyResult := &v1alpha1.NodeFeature{} obj, err := c.Fake. - Invokes(testing.NewGetAction(nodefeaturesResource, c.ns, name), &v1alpha1.NodeFeature{}) + Invokes(testing.NewGetActionWithOptions(nodefeaturesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeature), err } // List takes label and field selectors, and returns the list of NodeFeatures that match those selectors. func (c *FakeNodeFeatures) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureList, err error) { + emptyResult := &v1alpha1.NodeFeatureList{} obj, err := c.Fake. - Invokes(testing.NewListAction(nodefeaturesResource, nodefeaturesKind, c.ns, opts), &v1alpha1.NodeFeatureList{}) + Invokes(testing.NewListActionWithOptions(nodefeaturesResource, nodefeaturesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,28 +77,30 @@ func (c *FakeNodeFeatures) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested nodeFeatures. func (c *FakeNodeFeatures) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(nodefeaturesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(nodefeaturesResource, c.ns, opts)) } // Create takes the representation of a nodeFeature and creates it. Returns the server's representation of the nodeFeature, and an error, if there is any. func (c *FakeNodeFeatures) Create(ctx context.Context, nodeFeature *v1alpha1.NodeFeature, opts v1.CreateOptions) (result *v1alpha1.NodeFeature, err error) { + emptyResult := &v1alpha1.NodeFeature{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodefeaturesResource, c.ns, nodeFeature), &v1alpha1.NodeFeature{}) + Invokes(testing.NewCreateActionWithOptions(nodefeaturesResource, c.ns, nodeFeature, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeature), err } // Update takes the representation of a nodeFeature and updates it. Returns the server's representation of the nodeFeature, and an error, if there is any. func (c *FakeNodeFeatures) Update(ctx context.Context, nodeFeature *v1alpha1.NodeFeature, opts v1.UpdateOptions) (result *v1alpha1.NodeFeature, err error) { + emptyResult := &v1alpha1.NodeFeature{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodefeaturesResource, c.ns, nodeFeature), &v1alpha1.NodeFeature{}) + Invokes(testing.NewUpdateActionWithOptions(nodefeaturesResource, c.ns, nodeFeature, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeature), err } @@ -111,7 +115,7 @@ func (c *FakeNodeFeatures) Delete(ctx context.Context, name string, opts v1.Dele // DeleteCollection deletes a collection of objects. func (c *FakeNodeFeatures) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodefeaturesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(nodefeaturesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureList{}) return err @@ -119,11 +123,12 @@ func (c *FakeNodeFeatures) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched nodeFeature. func (c *FakeNodeFeatures) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeature, err error) { + emptyResult := &v1alpha1.NodeFeature{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodefeaturesResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeFeature{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(nodefeaturesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeature), err } diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturegroup.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturegroup.go index c104bb734..fdcacc968 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturegroup.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturegroup.go @@ -41,22 +41,24 @@ var nodefeaturegroupsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeFeatureGro // Get takes name of the nodeFeatureGroup, and returns the corresponding nodeFeatureGroup object, and an error if there is any. func (c *FakeNodeFeatureGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureGroup, err error) { + emptyResult := &v1alpha1.NodeFeatureGroup{} obj, err := c.Fake. - Invokes(testing.NewGetAction(nodefeaturegroupsResource, c.ns, name), &v1alpha1.NodeFeatureGroup{}) + Invokes(testing.NewGetActionWithOptions(nodefeaturegroupsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureGroup), err } // List takes label and field selectors, and returns the list of NodeFeatureGroups that match those selectors. func (c *FakeNodeFeatureGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureGroupList, err error) { + emptyResult := &v1alpha1.NodeFeatureGroupList{} obj, err := c.Fake. - Invokes(testing.NewListAction(nodefeaturegroupsResource, nodefeaturegroupsKind, c.ns, opts), &v1alpha1.NodeFeatureGroupList{}) + Invokes(testing.NewListActionWithOptions(nodefeaturegroupsResource, nodefeaturegroupsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,40 +77,43 @@ func (c *FakeNodeFeatureGroups) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested nodeFeatureGroups. func (c *FakeNodeFeatureGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(nodefeaturegroupsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(nodefeaturegroupsResource, c.ns, opts)) } // Create takes the representation of a nodeFeatureGroup and creates it. Returns the server's representation of the nodeFeatureGroup, and an error, if there is any. func (c *FakeNodeFeatureGroups) Create(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.CreateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { + emptyResult := &v1alpha1.NodeFeatureGroup{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodefeaturegroupsResource, c.ns, nodeFeatureGroup), &v1alpha1.NodeFeatureGroup{}) + Invokes(testing.NewCreateActionWithOptions(nodefeaturegroupsResource, c.ns, nodeFeatureGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureGroup), err } // Update takes the representation of a nodeFeatureGroup and updates it. Returns the server's representation of the nodeFeatureGroup, and an error, if there is any. func (c *FakeNodeFeatureGroups) Update(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { + emptyResult := &v1alpha1.NodeFeatureGroup{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodefeaturegroupsResource, c.ns, nodeFeatureGroup), &v1alpha1.NodeFeatureGroup{}) + Invokes(testing.NewUpdateActionWithOptions(nodefeaturegroupsResource, c.ns, nodeFeatureGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureGroup), 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 *FakeNodeFeatureGroups) UpdateStatus(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (*v1alpha1.NodeFeatureGroup, error) { +func (c *FakeNodeFeatureGroups) UpdateStatus(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { + emptyResult := &v1alpha1.NodeFeatureGroup{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(nodefeaturegroupsResource, "status", c.ns, nodeFeatureGroup), &v1alpha1.NodeFeatureGroup{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(nodefeaturegroupsResource, "status", c.ns, nodeFeatureGroup, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureGroup), err } @@ -123,7 +128,7 @@ func (c *FakeNodeFeatureGroups) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeNodeFeatureGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodefeaturegroupsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(nodefeaturegroupsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureGroupList{}) return err @@ -131,11 +136,12 @@ func (c *FakeNodeFeatureGroups) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched nodeFeatureGroup. func (c *FakeNodeFeatureGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeatureGroup, err error) { + emptyResult := &v1alpha1.NodeFeatureGroup{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodefeaturegroupsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeFeatureGroup{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(nodefeaturegroupsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureGroup), err } diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go index f096ae5e3..b2916717c 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go @@ -40,20 +40,22 @@ var nodefeaturerulesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeFeatureRule // Get takes name of the nodeFeatureRule, and returns the corresponding nodeFeatureRule object, and an error if there is any. func (c *FakeNodeFeatureRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureRule, err error) { + emptyResult := &v1alpha1.NodeFeatureRule{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(nodefeaturerulesResource, name), &v1alpha1.NodeFeatureRule{}) + Invokes(testing.NewRootGetActionWithOptions(nodefeaturerulesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureRule), err } // List takes label and field selectors, and returns the list of NodeFeatureRules that match those selectors. func (c *FakeNodeFeatureRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureRuleList, err error) { + emptyResult := &v1alpha1.NodeFeatureRuleList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(nodefeaturerulesResource, nodefeaturerulesKind, opts), &v1alpha1.NodeFeatureRuleList{}) + Invokes(testing.NewRootListActionWithOptions(nodefeaturerulesResource, nodefeaturerulesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,25 +74,27 @@ func (c *FakeNodeFeatureRules) List(ctx context.Context, opts v1.ListOptions) (r // Watch returns a watch.Interface that watches the requested nodeFeatureRules. func (c *FakeNodeFeatureRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(nodefeaturerulesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(nodefeaturerulesResource, opts)) } // Create takes the representation of a nodeFeatureRule and creates it. Returns the server's representation of the nodeFeatureRule, and an error, if there is any. func (c *FakeNodeFeatureRules) Create(ctx context.Context, nodeFeatureRule *v1alpha1.NodeFeatureRule, opts v1.CreateOptions) (result *v1alpha1.NodeFeatureRule, err error) { + emptyResult := &v1alpha1.NodeFeatureRule{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(nodefeaturerulesResource, nodeFeatureRule), &v1alpha1.NodeFeatureRule{}) + Invokes(testing.NewRootCreateActionWithOptions(nodefeaturerulesResource, nodeFeatureRule, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureRule), err } // Update takes the representation of a nodeFeatureRule and updates it. Returns the server's representation of the nodeFeatureRule, and an error, if there is any. func (c *FakeNodeFeatureRules) Update(ctx context.Context, nodeFeatureRule *v1alpha1.NodeFeatureRule, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureRule, err error) { + emptyResult := &v1alpha1.NodeFeatureRule{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(nodefeaturerulesResource, nodeFeatureRule), &v1alpha1.NodeFeatureRule{}) + Invokes(testing.NewRootUpdateActionWithOptions(nodefeaturerulesResource, nodeFeatureRule, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureRule), err } @@ -104,7 +108,7 @@ func (c *FakeNodeFeatureRules) Delete(ctx context.Context, name string, opts v1. // DeleteCollection deletes a collection of objects. func (c *FakeNodeFeatureRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(nodefeaturerulesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(nodefeaturerulesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureRuleList{}) return err @@ -112,10 +116,11 @@ func (c *FakeNodeFeatureRules) DeleteCollection(ctx context.Context, opts v1.Del // Patch applies the patch and returns the patched nodeFeatureRule. func (c *FakeNodeFeatureRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeatureRule, err error) { + emptyResult := &v1alpha1.NodeFeatureRule{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(nodefeaturerulesResource, name, pt, data, subresources...), &v1alpha1.NodeFeatureRule{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(nodefeaturerulesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.NodeFeatureRule), err } diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeature.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeature.go index f159be867..15e4e7013 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeature.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeature.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" 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" + gentype "k8s.io/client-go/gentype" scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -51,128 +50,18 @@ type NodeFeatureInterface interface { // nodeFeatures implements NodeFeatureInterface type nodeFeatures struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.NodeFeature, *v1alpha1.NodeFeatureList] } // newNodeFeatures returns a NodeFeatures func newNodeFeatures(c *NfdV1alpha1Client, namespace string) *nodeFeatures { return &nodeFeatures{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.NodeFeature, *v1alpha1.NodeFeatureList]( + "nodefeatures", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NodeFeature { return &v1alpha1.NodeFeature{} }, + func() *v1alpha1.NodeFeatureList { return &v1alpha1.NodeFeatureList{} }), } } - -// Get takes name of the nodeFeature, and returns the corresponding nodeFeature object, and an error if there is any. -func (c *nodeFeatures) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeature, err error) { - result = &v1alpha1.NodeFeature{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodefeatures"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeFeatures that match those selectors. -func (c *nodeFeatures) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeFeatureList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodefeatures"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeFeatures. -func (c *nodeFeatures) 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(). - Namespace(c.ns). - Resource("nodefeatures"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeFeature and creates it. Returns the server's representation of the nodeFeature, and an error, if there is any. -func (c *nodeFeatures) Create(ctx context.Context, nodeFeature *v1alpha1.NodeFeature, opts v1.CreateOptions) (result *v1alpha1.NodeFeature, err error) { - result = &v1alpha1.NodeFeature{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodefeatures"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeature). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeFeature and updates it. Returns the server's representation of the nodeFeature, and an error, if there is any. -func (c *nodeFeatures) Update(ctx context.Context, nodeFeature *v1alpha1.NodeFeature, opts v1.UpdateOptions) (result *v1alpha1.NodeFeature, err error) { - result = &v1alpha1.NodeFeature{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodefeatures"). - Name(nodeFeature.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeature). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeFeature and deletes it. Returns an error if one occurs. -func (c *nodeFeatures) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodefeatures"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeFeatures) 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(). - Namespace(c.ns). - Resource("nodefeatures"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeFeature. -func (c *nodeFeatures) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeature, err error) { - result = &v1alpha1.NodeFeature{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodefeatures"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturegroup.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturegroup.go index a988f3c8e..7d7e186c2 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturegroup.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturegroup.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" 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" + gentype "k8s.io/client-go/gentype" scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -40,6 +39,7 @@ type NodeFeatureGroupsGetter interface { type NodeFeatureGroupInterface interface { Create(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.CreateOptions) (*v1alpha1.NodeFeatureGroup, error) Update(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (*v1alpha1.NodeFeatureGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (*v1alpha1.NodeFeatureGroup, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,144 +52,18 @@ type NodeFeatureGroupInterface interface { // nodeFeatureGroups implements NodeFeatureGroupInterface type nodeFeatureGroups struct { - client rest.Interface - ns string + *gentype.ClientWithList[*v1alpha1.NodeFeatureGroup, *v1alpha1.NodeFeatureGroupList] } // newNodeFeatureGroups returns a NodeFeatureGroups func newNodeFeatureGroups(c *NfdV1alpha1Client, namespace string) *nodeFeatureGroups { return &nodeFeatureGroups{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithList[*v1alpha1.NodeFeatureGroup, *v1alpha1.NodeFeatureGroupList]( + "nodefeaturegroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NodeFeatureGroup { return &v1alpha1.NodeFeatureGroup{} }, + func() *v1alpha1.NodeFeatureGroupList { return &v1alpha1.NodeFeatureGroupList{} }), } } - -// Get takes name of the nodeFeatureGroup, and returns the corresponding nodeFeatureGroup object, and an error if there is any. -func (c *nodeFeatureGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureGroup, err error) { - result = &v1alpha1.NodeFeatureGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeFeatureGroups that match those selectors. -func (c *nodeFeatureGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeFeatureGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeFeatureGroups. -func (c *nodeFeatureGroups) 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(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeFeatureGroup and creates it. Returns the server's representation of the nodeFeatureGroup, and an error, if there is any. -func (c *nodeFeatureGroups) Create(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.CreateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { - result = &v1alpha1.NodeFeatureGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeatureGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeFeatureGroup and updates it. Returns the server's representation of the nodeFeatureGroup, and an error, if there is any. -func (c *nodeFeatureGroups) Update(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { - result = &v1alpha1.NodeFeatureGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - Name(nodeFeatureGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeatureGroup). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *nodeFeatureGroups) UpdateStatus(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureGroup, err error) { - result = &v1alpha1.NodeFeatureGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - Name(nodeFeatureGroup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeatureGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeFeatureGroup and deletes it. Returns an error if one occurs. -func (c *nodeFeatureGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeFeatureGroups) 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(). - Namespace(c.ns). - Resource("nodefeaturegroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeFeatureGroup. -func (c *nodeFeatureGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeatureGroup, err error) { - result = &v1alpha1.NodeFeatureGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodefeaturegroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go index 843c13768..e4a500732 100644 --- a/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go +++ b/api/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go @@ -20,12 +20,11 @@ package v1alpha1 import ( "context" - "time" 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" + gentype "k8s.io/client-go/gentype" scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -51,118 +50,18 @@ type NodeFeatureRuleInterface interface { // nodeFeatureRules implements NodeFeatureRuleInterface type nodeFeatureRules struct { - client rest.Interface + *gentype.ClientWithList[*v1alpha1.NodeFeatureRule, *v1alpha1.NodeFeatureRuleList] } // newNodeFeatureRules returns a NodeFeatureRules func newNodeFeatureRules(c *NfdV1alpha1Client) *nodeFeatureRules { return &nodeFeatureRules{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1alpha1.NodeFeatureRule, *v1alpha1.NodeFeatureRuleList]( + "nodefeaturerules", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1alpha1.NodeFeatureRule { return &v1alpha1.NodeFeatureRule{} }, + func() *v1alpha1.NodeFeatureRuleList { return &v1alpha1.NodeFeatureRuleList{} }), } } - -// Get takes name of the nodeFeatureRule, and returns the corresponding nodeFeatureRule object, and an error if there is any. -func (c *nodeFeatureRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureRule, err error) { - result = &v1alpha1.NodeFeatureRule{} - err = c.client.Get(). - Resource("nodefeaturerules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeFeatureRules that match those selectors. -func (c *nodeFeatureRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeFeatureRuleList{} - err = c.client.Get(). - Resource("nodefeaturerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeFeatureRules. -func (c *nodeFeatureRules) 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("nodefeaturerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeFeatureRule and creates it. Returns the server's representation of the nodeFeatureRule, and an error, if there is any. -func (c *nodeFeatureRules) Create(ctx context.Context, nodeFeatureRule *v1alpha1.NodeFeatureRule, opts v1.CreateOptions) (result *v1alpha1.NodeFeatureRule, err error) { - result = &v1alpha1.NodeFeatureRule{} - err = c.client.Post(). - Resource("nodefeaturerules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeatureRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeFeatureRule and updates it. Returns the server's representation of the nodeFeatureRule, and an error, if there is any. -func (c *nodeFeatureRules) Update(ctx context.Context, nodeFeatureRule *v1alpha1.NodeFeatureRule, opts v1.UpdateOptions) (result *v1alpha1.NodeFeatureRule, err error) { - result = &v1alpha1.NodeFeatureRule{} - err = c.client.Put(). - Resource("nodefeaturerules"). - Name(nodeFeatureRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeFeatureRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeFeatureRule and deletes it. Returns an error if one occurs. -func (c *nodeFeatureRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("nodefeaturerules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeFeatureRules) 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("nodefeaturerules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeFeatureRule. -func (c *nodeFeatureRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeFeatureRule, err error) { - result = &v1alpha1.NodeFeatureRule{} - err = c.client.Patch(pt). - Resource("nodefeaturerules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/api/generated/informers/externalversions/factory.go b/api/generated/informers/externalversions/factory.go index 54812d547..0bc947593 100644 --- a/api/generated/informers/externalversions/factory.go +++ b/api/generated/informers/externalversions/factory.go @@ -228,6 +228,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/api/generated/listers/nfd/v1alpha1/nodefeature.go b/api/generated/listers/nfd/v1alpha1/nodefeature.go index ca3a184da..e1badec17 100644 --- a/api/generated/listers/nfd/v1alpha1/nodefeature.go +++ b/api/generated/listers/nfd/v1alpha1/nodefeature.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -38,25 +38,17 @@ type NodeFeatureLister interface { // nodeFeatureLister implements the NodeFeatureLister interface. type nodeFeatureLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.NodeFeature] } // NewNodeFeatureLister returns a new NodeFeatureLister. func NewNodeFeatureLister(indexer cache.Indexer) NodeFeatureLister { - return &nodeFeatureLister{indexer: indexer} -} - -// List lists all NodeFeatures in the indexer. -func (s *nodeFeatureLister) List(selector labels.Selector) (ret []*v1alpha1.NodeFeature, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeFeature)) - }) - return ret, err + return &nodeFeatureLister{listers.New[*v1alpha1.NodeFeature](indexer, v1alpha1.Resource("nodefeature"))} } // NodeFeatures returns an object that can list and get NodeFeatures. func (s *nodeFeatureLister) NodeFeatures(namespace string) NodeFeatureNamespaceLister { - return nodeFeatureNamespaceLister{indexer: s.indexer, namespace: namespace} + return nodeFeatureNamespaceLister{listers.NewNamespaced[*v1alpha1.NodeFeature](s.ResourceIndexer, namespace)} } // NodeFeatureNamespaceLister helps list and get NodeFeatures. @@ -74,26 +66,5 @@ type NodeFeatureNamespaceLister interface { // nodeFeatureNamespaceLister implements the NodeFeatureNamespaceLister // interface. type nodeFeatureNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NodeFeatures in the indexer for a given namespace. -func (s nodeFeatureNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeFeature, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeFeature)) - }) - return ret, err -} - -// Get retrieves the NodeFeature from the indexer for a given namespace and name. -func (s nodeFeatureNamespaceLister) Get(name string) (*v1alpha1.NodeFeature, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodefeature"), name) - } - return obj.(*v1alpha1.NodeFeature), nil + listers.ResourceIndexer[*v1alpha1.NodeFeature] } diff --git a/api/generated/listers/nfd/v1alpha1/nodefeaturegroup.go b/api/generated/listers/nfd/v1alpha1/nodefeaturegroup.go index 48d87107a..6315f9ef5 100644 --- a/api/generated/listers/nfd/v1alpha1/nodefeaturegroup.go +++ b/api/generated/listers/nfd/v1alpha1/nodefeaturegroup.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -38,25 +38,17 @@ type NodeFeatureGroupLister interface { // nodeFeatureGroupLister implements the NodeFeatureGroupLister interface. type nodeFeatureGroupLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.NodeFeatureGroup] } // NewNodeFeatureGroupLister returns a new NodeFeatureGroupLister. func NewNodeFeatureGroupLister(indexer cache.Indexer) NodeFeatureGroupLister { - return &nodeFeatureGroupLister{indexer: indexer} -} - -// List lists all NodeFeatureGroups in the indexer. -func (s *nodeFeatureGroupLister) List(selector labels.Selector) (ret []*v1alpha1.NodeFeatureGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeFeatureGroup)) - }) - return ret, err + return &nodeFeatureGroupLister{listers.New[*v1alpha1.NodeFeatureGroup](indexer, v1alpha1.Resource("nodefeaturegroup"))} } // NodeFeatureGroups returns an object that can list and get NodeFeatureGroups. func (s *nodeFeatureGroupLister) NodeFeatureGroups(namespace string) NodeFeatureGroupNamespaceLister { - return nodeFeatureGroupNamespaceLister{indexer: s.indexer, namespace: namespace} + return nodeFeatureGroupNamespaceLister{listers.NewNamespaced[*v1alpha1.NodeFeatureGroup](s.ResourceIndexer, namespace)} } // NodeFeatureGroupNamespaceLister helps list and get NodeFeatureGroups. @@ -74,26 +66,5 @@ type NodeFeatureGroupNamespaceLister interface { // nodeFeatureGroupNamespaceLister implements the NodeFeatureGroupNamespaceLister // interface. type nodeFeatureGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NodeFeatureGroups in the indexer for a given namespace. -func (s nodeFeatureGroupNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeFeatureGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeFeatureGroup)) - }) - return ret, err -} - -// Get retrieves the NodeFeatureGroup from the indexer for a given namespace and name. -func (s nodeFeatureGroupNamespaceLister) Get(name string) (*v1alpha1.NodeFeatureGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodefeaturegroup"), name) - } - return obj.(*v1alpha1.NodeFeatureGroup), nil + listers.ResourceIndexer[*v1alpha1.NodeFeatureGroup] } diff --git a/api/generated/listers/nfd/v1alpha1/nodefeaturerule.go b/api/generated/listers/nfd/v1alpha1/nodefeaturerule.go index 6f8bf2b11..15ecdd811 100644 --- a/api/generated/listers/nfd/v1alpha1/nodefeaturerule.go +++ b/api/generated/listers/nfd/v1alpha1/nodefeaturerule.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1" ) @@ -39,30 +39,10 @@ type NodeFeatureRuleLister interface { // nodeFeatureRuleLister implements the NodeFeatureRuleLister interface. type nodeFeatureRuleLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.NodeFeatureRule] } // NewNodeFeatureRuleLister returns a new NodeFeatureRuleLister. func NewNodeFeatureRuleLister(indexer cache.Indexer) NodeFeatureRuleLister { - return &nodeFeatureRuleLister{indexer: indexer} -} - -// List lists all NodeFeatureRules in the indexer. -func (s *nodeFeatureRuleLister) List(selector labels.Selector) (ret []*v1alpha1.NodeFeatureRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeFeatureRule)) - }) - return ret, err -} - -// Get retrieves the NodeFeatureRule from the index for a given name. -func (s *nodeFeatureRuleLister) Get(name string) (*v1alpha1.NodeFeatureRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodefeaturerule"), name) - } - return obj.(*v1alpha1.NodeFeatureRule), nil + return &nodeFeatureRuleLister{listers.New[*v1alpha1.NodeFeatureRule](indexer, v1alpha1.Resource("nodefeaturerule"))} } diff --git a/deployment/base/nfd-crds/nfd-api-crds.yaml b/deployment/base/nfd-crds/nfd-api-crds.yaml index 0a73c5dca..56142c6ce 100644 --- a/deployment/base/nfd-crds/nfd-api-crds.yaml +++ b/deployment/base/nfd-crds/nfd-api-crds.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeatures.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io @@ -124,7 +124,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeaturegroups.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io @@ -395,7 +395,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeaturerules.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io diff --git a/deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml b/deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml index 0a73c5dca..56142c6ce 100644 --- a/deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml +++ b/deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeatures.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io @@ -124,7 +124,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeaturegroups.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io @@ -395,7 +395,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: nodefeaturerules.nfd.k8s-sigs.io spec: group: nfd.k8s-sigs.io