mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Update auto-generated code
Run make generate after updating generator tools.
This commit is contained in:
parent
4d102c599c
commit
403ad6cd7c
13 changed files with 108 additions and 503 deletions
|
@ -31,8 +31,12 @@ import (
|
||||||
|
|
||||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
// 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,
|
// 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.
|
// 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 {
|
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||||
for _, obj := range objects {
|
for _, obj := range objects {
|
||||||
|
|
|
@ -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.
|
// 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) {
|
func (c *FakeNodeFeatures) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeature, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeature{}
|
||||||
obj, err := c.Fake.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeature), err
|
return obj.(*v1alpha1.NodeFeature), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of NodeFeatures that match those selectors.
|
// 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) {
|
func (c *FakeNodeFeatures) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureList, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeatureList{}
|
||||||
obj, err := c.Fake.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
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.
|
// Watch returns a watch.Interface that watches the requested nodeFeatures.
|
||||||
func (c *FakeNodeFeatures) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
func (c *FakeNodeFeatures) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
return c.Fake.
|
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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeature), 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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeature), 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.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *FakeNodeFeatures) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
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{})
|
_, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureList{})
|
||||||
return err
|
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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeature), err
|
return obj.(*v1alpha1.NodeFeature), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// 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) {
|
func (c *FakeNodeFeatureGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureGroup, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeatureGroup{}
|
||||||
obj, err := c.Fake.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureGroup), err
|
return obj.(*v1alpha1.NodeFeatureGroup), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of NodeFeatureGroups that match those selectors.
|
// 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) {
|
func (c *FakeNodeFeatureGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureGroupList, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeatureGroupList{}
|
||||||
obj, err := c.Fake.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
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.
|
// Watch returns a watch.Interface that watches the requested nodeFeatureGroups.
|
||||||
func (c *FakeNodeFeatureGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
func (c *FakeNodeFeatureGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
return c.Fake.
|
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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureGroup), 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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureGroup), err
|
return obj.(*v1alpha1.NodeFeatureGroup), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
// UpdateStatus was generated because the type contains a Status member.
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
// 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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureGroup), 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.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *FakeNodeFeatureGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
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{})
|
_, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureGroupList{})
|
||||||
return err
|
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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureGroup), err
|
return obj.(*v1alpha1.NodeFeatureGroup), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// 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) {
|
func (c *FakeNodeFeatureRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeFeatureRule, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeatureRule{}
|
||||||
obj, err := c.Fake.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewRootGetAction(nodefeaturerulesResource, name), &v1alpha1.NodeFeatureRule{})
|
Invokes(testing.NewRootGetActionWithOptions(nodefeaturerulesResource, name, options), emptyResult)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureRule), err
|
return obj.(*v1alpha1.NodeFeatureRule), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of NodeFeatureRules that match those selectors.
|
// 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) {
|
func (c *FakeNodeFeatureRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeFeatureRuleList, err error) {
|
||||||
|
emptyResult := &v1alpha1.NodeFeatureRuleList{}
|
||||||
obj, err := c.Fake.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewRootListAction(nodefeaturerulesResource, nodefeaturerulesKind, opts), &v1alpha1.NodeFeatureRuleList{})
|
Invokes(testing.NewRootListActionWithOptions(nodefeaturerulesResource, nodefeaturerulesKind, opts), emptyResult)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
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.
|
// Watch returns a watch.Interface that watches the requested nodeFeatureRules.
|
||||||
func (c *FakeNodeFeatureRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
func (c *FakeNodeFeatureRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||||
return c.Fake.
|
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.
|
// 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) {
|
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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewRootCreateAction(nodefeaturerulesResource, nodeFeatureRule), &v1alpha1.NodeFeatureRule{})
|
Invokes(testing.NewRootCreateActionWithOptions(nodefeaturerulesResource, nodeFeatureRule, opts), emptyResult)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureRule), 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.
|
// 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) {
|
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.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewRootUpdateAction(nodefeaturerulesResource, nodeFeatureRule), &v1alpha1.NodeFeatureRule{})
|
Invokes(testing.NewRootUpdateActionWithOptions(nodefeaturerulesResource, nodeFeatureRule, opts), emptyResult)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureRule), 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.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *FakeNodeFeatureRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
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{})
|
_, err := c.Fake.Invokes(action, &v1alpha1.NodeFeatureRuleList{})
|
||||||
return err
|
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.
|
// 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) {
|
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.
|
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 {
|
if obj == nil {
|
||||||
return nil, err
|
return emptyResult, err
|
||||||
}
|
}
|
||||||
return obj.(*v1alpha1.NodeFeatureRule), err
|
return obj.(*v1alpha1.NodeFeatureRule), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,11 @@ package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
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"
|
scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -51,128 +50,18 @@ type NodeFeatureInterface interface {
|
||||||
|
|
||||||
// nodeFeatures implements NodeFeatureInterface
|
// nodeFeatures implements NodeFeatureInterface
|
||||||
type nodeFeatures struct {
|
type nodeFeatures struct {
|
||||||
client rest.Interface
|
*gentype.ClientWithList[*v1alpha1.NodeFeature, *v1alpha1.NodeFeatureList]
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNodeFeatures returns a NodeFeatures
|
// newNodeFeatures returns a NodeFeatures
|
||||||
func newNodeFeatures(c *NfdV1alpha1Client, namespace string) *nodeFeatures {
|
func newNodeFeatures(c *NfdV1alpha1Client, namespace string) *nodeFeatures {
|
||||||
return &nodeFeatures{
|
return &nodeFeatures{
|
||||||
client: c.RESTClient(),
|
gentype.NewClientWithList[*v1alpha1.NodeFeature, *v1alpha1.NodeFeatureList](
|
||||||
ns: namespace,
|
"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
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,12 +20,11 @@ package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
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"
|
scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -40,6 +39,7 @@ type NodeFeatureGroupsGetter interface {
|
||||||
type NodeFeatureGroupInterface interface {
|
type NodeFeatureGroupInterface interface {
|
||||||
Create(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.CreateOptions) (*v1alpha1.NodeFeatureGroup, error)
|
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)
|
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)
|
UpdateStatus(ctx context.Context, nodeFeatureGroup *v1alpha1.NodeFeatureGroup, opts v1.UpdateOptions) (*v1alpha1.NodeFeatureGroup, error)
|
||||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||||
|
@ -52,144 +52,18 @@ type NodeFeatureGroupInterface interface {
|
||||||
|
|
||||||
// nodeFeatureGroups implements NodeFeatureGroupInterface
|
// nodeFeatureGroups implements NodeFeatureGroupInterface
|
||||||
type nodeFeatureGroups struct {
|
type nodeFeatureGroups struct {
|
||||||
client rest.Interface
|
*gentype.ClientWithList[*v1alpha1.NodeFeatureGroup, *v1alpha1.NodeFeatureGroupList]
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNodeFeatureGroups returns a NodeFeatureGroups
|
// newNodeFeatureGroups returns a NodeFeatureGroups
|
||||||
func newNodeFeatureGroups(c *NfdV1alpha1Client, namespace string) *nodeFeatureGroups {
|
func newNodeFeatureGroups(c *NfdV1alpha1Client, namespace string) *nodeFeatureGroups {
|
||||||
return &nodeFeatureGroups{
|
return &nodeFeatureGroups{
|
||||||
client: c.RESTClient(),
|
gentype.NewClientWithList[*v1alpha1.NodeFeatureGroup, *v1alpha1.NodeFeatureGroupList](
|
||||||
ns: namespace,
|
"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
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,12 +20,11 @@ package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
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"
|
scheme "sigs.k8s.io/node-feature-discovery/api/generated/clientset/versioned/scheme"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -51,118 +50,18 @@ type NodeFeatureRuleInterface interface {
|
||||||
|
|
||||||
// nodeFeatureRules implements NodeFeatureRuleInterface
|
// nodeFeatureRules implements NodeFeatureRuleInterface
|
||||||
type nodeFeatureRules struct {
|
type nodeFeatureRules struct {
|
||||||
client rest.Interface
|
*gentype.ClientWithList[*v1alpha1.NodeFeatureRule, *v1alpha1.NodeFeatureRuleList]
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNodeFeatureRules returns a NodeFeatureRules
|
// newNodeFeatureRules returns a NodeFeatureRules
|
||||||
func newNodeFeatureRules(c *NfdV1alpha1Client) *nodeFeatureRules {
|
func newNodeFeatureRules(c *NfdV1alpha1Client) *nodeFeatureRules {
|
||||||
return &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
|
|
||||||
}
|
|
||||||
|
|
|
@ -228,6 +228,7 @@ type SharedInformerFactory interface {
|
||||||
|
|
||||||
// Start initializes all requested informers. They are handled in goroutines
|
// Start initializes all requested informers. They are handled in goroutines
|
||||||
// which run until the stop channel gets closed.
|
// 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{})
|
Start(stopCh <-chan struct{})
|
||||||
|
|
||||||
// Shutdown marks a factory as shutting down. At that point no new
|
// Shutdown marks a factory as shutting down. At that point no new
|
||||||
|
|
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/listers"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -38,25 +38,17 @@ type NodeFeatureLister interface {
|
||||||
|
|
||||||
// nodeFeatureLister implements the NodeFeatureLister interface.
|
// nodeFeatureLister implements the NodeFeatureLister interface.
|
||||||
type nodeFeatureLister struct {
|
type nodeFeatureLister struct {
|
||||||
indexer cache.Indexer
|
listers.ResourceIndexer[*v1alpha1.NodeFeature]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeFeatureLister returns a new NodeFeatureLister.
|
// NewNodeFeatureLister returns a new NodeFeatureLister.
|
||||||
func NewNodeFeatureLister(indexer cache.Indexer) NodeFeatureLister {
|
func NewNodeFeatureLister(indexer cache.Indexer) NodeFeatureLister {
|
||||||
return &nodeFeatureLister{indexer: indexer}
|
return &nodeFeatureLister{listers.New[*v1alpha1.NodeFeature](indexer, v1alpha1.Resource("nodefeature"))}
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeFeatures returns an object that can list and get NodeFeatures.
|
// NodeFeatures returns an object that can list and get NodeFeatures.
|
||||||
func (s *nodeFeatureLister) NodeFeatures(namespace string) NodeFeatureNamespaceLister {
|
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.
|
// NodeFeatureNamespaceLister helps list and get NodeFeatures.
|
||||||
|
@ -74,26 +66,5 @@ type NodeFeatureNamespaceLister interface {
|
||||||
// nodeFeatureNamespaceLister implements the NodeFeatureNamespaceLister
|
// nodeFeatureNamespaceLister implements the NodeFeatureNamespaceLister
|
||||||
// interface.
|
// interface.
|
||||||
type nodeFeatureNamespaceLister struct {
|
type nodeFeatureNamespaceLister struct {
|
||||||
indexer cache.Indexer
|
listers.ResourceIndexer[*v1alpha1.NodeFeature]
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/listers"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -38,25 +38,17 @@ type NodeFeatureGroupLister interface {
|
||||||
|
|
||||||
// nodeFeatureGroupLister implements the NodeFeatureGroupLister interface.
|
// nodeFeatureGroupLister implements the NodeFeatureGroupLister interface.
|
||||||
type nodeFeatureGroupLister struct {
|
type nodeFeatureGroupLister struct {
|
||||||
indexer cache.Indexer
|
listers.ResourceIndexer[*v1alpha1.NodeFeatureGroup]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeFeatureGroupLister returns a new NodeFeatureGroupLister.
|
// NewNodeFeatureGroupLister returns a new NodeFeatureGroupLister.
|
||||||
func NewNodeFeatureGroupLister(indexer cache.Indexer) NodeFeatureGroupLister {
|
func NewNodeFeatureGroupLister(indexer cache.Indexer) NodeFeatureGroupLister {
|
||||||
return &nodeFeatureGroupLister{indexer: indexer}
|
return &nodeFeatureGroupLister{listers.New[*v1alpha1.NodeFeatureGroup](indexer, v1alpha1.Resource("nodefeaturegroup"))}
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeFeatureGroups returns an object that can list and get NodeFeatureGroups.
|
// NodeFeatureGroups returns an object that can list and get NodeFeatureGroups.
|
||||||
func (s *nodeFeatureGroupLister) NodeFeatureGroups(namespace string) NodeFeatureGroupNamespaceLister {
|
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.
|
// NodeFeatureGroupNamespaceLister helps list and get NodeFeatureGroups.
|
||||||
|
@ -74,26 +66,5 @@ type NodeFeatureGroupNamespaceLister interface {
|
||||||
// nodeFeatureGroupNamespaceLister implements the NodeFeatureGroupNamespaceLister
|
// nodeFeatureGroupNamespaceLister implements the NodeFeatureGroupNamespaceLister
|
||||||
// interface.
|
// interface.
|
||||||
type nodeFeatureGroupNamespaceLister struct {
|
type nodeFeatureGroupNamespaceLister struct {
|
||||||
indexer cache.Indexer
|
listers.ResourceIndexer[*v1alpha1.NodeFeatureGroup]
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/client-go/listers"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
v1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
|
||||||
)
|
)
|
||||||
|
@ -39,30 +39,10 @@ type NodeFeatureRuleLister interface {
|
||||||
|
|
||||||
// nodeFeatureRuleLister implements the NodeFeatureRuleLister interface.
|
// nodeFeatureRuleLister implements the NodeFeatureRuleLister interface.
|
||||||
type nodeFeatureRuleLister struct {
|
type nodeFeatureRuleLister struct {
|
||||||
indexer cache.Indexer
|
listers.ResourceIndexer[*v1alpha1.NodeFeatureRule]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeFeatureRuleLister returns a new NodeFeatureRuleLister.
|
// NewNodeFeatureRuleLister returns a new NodeFeatureRuleLister.
|
||||||
func NewNodeFeatureRuleLister(indexer cache.Indexer) NodeFeatureRuleLister {
|
func NewNodeFeatureRuleLister(indexer cache.Indexer) NodeFeatureRuleLister {
|
||||||
return &nodeFeatureRuleLister{indexer: indexer}
|
return &nodeFeatureRuleLister{listers.New[*v1alpha1.NodeFeatureRule](indexer, v1alpha1.Resource("nodefeaturerule"))}
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeatures.nfd.k8s-sigs.io
|
name: nodefeatures.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
@ -124,7 +124,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeaturegroups.nfd.k8s-sigs.io
|
name: nodefeaturegroups.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
@ -395,7 +395,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeaturerules.nfd.k8s-sigs.io
|
name: nodefeaturerules.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
|
|
@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeatures.nfd.k8s-sigs.io
|
name: nodefeatures.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
@ -124,7 +124,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeaturegroups.nfd.k8s-sigs.io
|
name: nodefeaturegroups.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
@ -395,7 +395,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.16.3
|
||||||
name: nodefeaturerules.nfd.k8s-sigs.io
|
name: nodefeaturerules.nfd.k8s-sigs.io
|
||||||
spec:
|
spec:
|
||||||
group: nfd.k8s-sigs.io
|
group: nfd.k8s-sigs.io
|
||||||
|
|
Loading…
Reference in a new issue