dra api: rename NodeResourceSlice -> ResourceSlice

While currently those objects only get published by the kubelet for node-local
resources, this could change once we also support network-attached
resources. Dropping the "Node" prefix enables such a future extension.

The NodeName in ResourceSlice and StructuredResourceHandle then becomes
optional. The kubelet still needs to provide one and it must match its own node
name, otherwise it doesn't have permission to access ResourceSlice objects.

Kubernetes-commit: 0b6a0d686a060b5d5ff92cea931aacd4eba85adb
This commit is contained in:
Patrick Ohly 2024-03-07 10:14:11 +01:00 committed by Kubernetes Publisher
parent 4c32855540
commit fee411cff2
16 changed files with 518 additions and 520 deletions

View File

@ -12079,30 +12079,6 @@ var schemaYAML = typed.YAMLObject(`types:
elementType: elementType:
scalar: string scalar: string
elementRelationship: atomic elementRelationship: atomic
- name: io.k8s.api.resource.v1alpha2.NodeResourceSlice
map:
fields:
- name: apiVersion
type:
scalar: string
- name: driverName
type:
scalar: string
default: ""
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesResources
- name: nodeName
type:
scalar: string
default: ""
- name: io.k8s.api.resource.v1alpha2.PodSchedulingContext - name: io.k8s.api.resource.v1alpha2.PodSchedulingContext
map: map:
fields: fields:
@ -12399,13 +12375,35 @@ var schemaYAML = typed.YAMLObject(`types:
- name: vendorParameters - name: vendorParameters
type: type:
namedType: __untyped_atomic_ namedType: __untyped_atomic_
- name: io.k8s.api.resource.v1alpha2.ResourceSlice
map:
fields:
- name: apiVersion
type:
scalar: string
- name: driverName
type:
scalar: string
default: ""
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesResources
- name: nodeName
type:
scalar: string
- name: io.k8s.api.resource.v1alpha2.StructuredResourceHandle - name: io.k8s.api.resource.v1alpha2.StructuredResourceHandle
map: map:
fields: fields:
- name: nodeName - name: nodeName
type: type:
scalar: string scalar: string
default: ""
- name: results - name: results
type: type:
list: list:

View File

@ -27,9 +27,9 @@ import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1" v1 "k8s.io/client-go/applyconfigurations/meta/v1"
) )
// NodeResourceSliceApplyConfiguration represents an declarative configuration of the NodeResourceSlice type for use // ResourceSliceApplyConfiguration represents an declarative configuration of the ResourceSlice type for use
// with apply. // with apply.
type NodeResourceSliceApplyConfiguration struct { type ResourceSliceApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"` v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
NodeName *string `json:"nodeName,omitempty"` NodeName *string `json:"nodeName,omitempty"`
@ -37,47 +37,47 @@ type NodeResourceSliceApplyConfiguration struct {
NodeResourceModelApplyConfiguration `json:",inline"` NodeResourceModelApplyConfiguration `json:",inline"`
} }
// NodeResourceSlice constructs an declarative configuration of the NodeResourceSlice type for use with // ResourceSlice constructs an declarative configuration of the ResourceSlice type for use with
// apply. // apply.
func NodeResourceSlice(name string) *NodeResourceSliceApplyConfiguration { func ResourceSlice(name string) *ResourceSliceApplyConfiguration {
b := &NodeResourceSliceApplyConfiguration{} b := &ResourceSliceApplyConfiguration{}
b.WithName(name) b.WithName(name)
b.WithKind("NodeResourceSlice") b.WithKind("ResourceSlice")
b.WithAPIVersion("resource.k8s.io/v1alpha2") b.WithAPIVersion("resource.k8s.io/v1alpha2")
return b return b
} }
// ExtractNodeResourceSlice extracts the applied configuration owned by fieldManager from // ExtractResourceSlice extracts the applied configuration owned by fieldManager from
// nodeResourceSlice. If no managedFields are found in nodeResourceSlice for fieldManager, a // resourceSlice. If no managedFields are found in resourceSlice for fieldManager, a
// NodeResourceSliceApplyConfiguration is returned with only the Name, Namespace (if applicable), // ResourceSliceApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other // APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because // field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields. // the fieldManager never owned fields any fields.
// nodeResourceSlice must be a unmodified NodeResourceSlice API object that was retrieved from the Kubernetes API. // resourceSlice must be a unmodified ResourceSlice API object that was retrieved from the Kubernetes API.
// ExtractNodeResourceSlice provides a way to perform a extract/modify-in-place/apply workflow. // ExtractResourceSlice provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields. // applied if another fieldManager has updated or force applied any of the previously applied fields.
// Experimental! // Experimental!
func ExtractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) { func ExtractResourceSlice(resourceSlice *resourcev1alpha2.ResourceSlice, fieldManager string) (*ResourceSliceApplyConfiguration, error) {
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "") return extractResourceSlice(resourceSlice, fieldManager, "")
} }
// ExtractNodeResourceSliceStatus is the same as ExtractNodeResourceSlice except // ExtractResourceSliceStatus is the same as ExtractResourceSlice except
// that it extracts the status subresource applied configuration. // that it extracts the status subresource applied configuration.
// Experimental! // Experimental!
func ExtractNodeResourceSliceStatus(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) { func ExtractResourceSliceStatus(resourceSlice *resourcev1alpha2.ResourceSlice, fieldManager string) (*ResourceSliceApplyConfiguration, error) {
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "status") return extractResourceSlice(resourceSlice, fieldManager, "status")
} }
func extractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string, subresource string) (*NodeResourceSliceApplyConfiguration, error) { func extractResourceSlice(resourceSlice *resourcev1alpha2.ResourceSlice, fieldManager string, subresource string) (*ResourceSliceApplyConfiguration, error) {
b := &NodeResourceSliceApplyConfiguration{} b := &ResourceSliceApplyConfiguration{}
err := managedfields.ExtractInto(nodeResourceSlice, internal.Parser().Type("io.k8s.api.resource.v1alpha2.NodeResourceSlice"), fieldManager, b, subresource) err := managedfields.ExtractInto(resourceSlice, internal.Parser().Type("io.k8s.api.resource.v1alpha2.ResourceSlice"), fieldManager, b, subresource)
if err != nil { if err != nil {
return nil, err return nil, err
} }
b.WithName(nodeResourceSlice.Name) b.WithName(resourceSlice.Name)
b.WithKind("NodeResourceSlice") b.WithKind("ResourceSlice")
b.WithAPIVersion("resource.k8s.io/v1alpha2") b.WithAPIVersion("resource.k8s.io/v1alpha2")
return b, nil return b, nil
} }
@ -85,7 +85,7 @@ func extractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSl
// WithKind sets the Kind field in the declarative configuration to the given value // WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call. // If called multiple times, the Kind field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithKind(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithKind(value string) *ResourceSliceApplyConfiguration {
b.Kind = &value b.Kind = &value
return b return b
} }
@ -93,7 +93,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithKind(value string) *NodeResour
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call. // If called multiple times, the APIVersion field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithAPIVersion(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithAPIVersion(value string) *ResourceSliceApplyConfiguration {
b.APIVersion = &value b.APIVersion = &value
return b return b
} }
@ -101,7 +101,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithAPIVersion(value string) *Node
// WithName sets the Name field in the declarative configuration to the given value // WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call. // If called multiple times, the Name field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithName(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithName(value string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.Name = &value b.Name = &value
return b return b
@ -110,7 +110,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithName(value string) *NodeResour
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call. // If called multiple times, the GenerateName field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithGenerateName(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithGenerateName(value string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.GenerateName = &value b.GenerateName = &value
return b return b
@ -119,7 +119,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithGenerateName(value string) *No
// WithNamespace sets the Namespace field in the declarative configuration to the given value // WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call. // If called multiple times, the Namespace field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithNamespace(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithNamespace(value string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.Namespace = &value b.Namespace = &value
return b return b
@ -128,7 +128,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithNamespace(value string) *NodeR
// WithUID sets the UID field in the declarative configuration to the given value // WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call. // If called multiple times, the UID field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithUID(value types.UID) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithUID(value types.UID) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.UID = &value b.UID = &value
return b return b
@ -137,7 +137,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithUID(value types.UID) *NodeReso
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call. // If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithResourceVersion(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithResourceVersion(value string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.ResourceVersion = &value b.ResourceVersion = &value
return b return b
@ -146,7 +146,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithResourceVersion(value string)
// WithGeneration sets the Generation field in the declarative configuration to the given value // WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call. // If called multiple times, the Generation field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithGeneration(value int64) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithGeneration(value int64) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.Generation = &value b.Generation = &value
return b return b
@ -155,7 +155,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithGeneration(value int64) *NodeR
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call. // If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.CreationTimestamp = &value b.CreationTimestamp = &value
return b return b
@ -164,7 +164,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithCreationTimestamp(value metav1
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call. // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.DeletionTimestamp = &value b.DeletionTimestamp = &value
return b return b
@ -173,7 +173,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithDeletionTimestamp(value metav1
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
b.DeletionGracePeriodSeconds = &value b.DeletionGracePeriodSeconds = &value
return b return b
@ -183,7 +183,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithDeletionGracePeriodSeconds(val
// and returns the receiver, so that objects can be build by chaining "With" function invocations. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field, // If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key. // overwriting an existing map entries in Labels field with the same key.
func (b *NodeResourceSliceApplyConfiguration) WithLabels(entries map[string]string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithLabels(entries map[string]string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
if b.Labels == nil && len(entries) > 0 { if b.Labels == nil && len(entries) > 0 {
b.Labels = make(map[string]string, len(entries)) b.Labels = make(map[string]string, len(entries))
@ -198,7 +198,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithLabels(entries map[string]stri
// and returns the receiver, so that objects can be build by chaining "With" function invocations. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field, // If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key. // overwriting an existing map entries in Annotations field with the same key.
func (b *NodeResourceSliceApplyConfiguration) WithAnnotations(entries map[string]string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
if b.Annotations == nil && len(entries) > 0 { if b.Annotations == nil && len(entries) > 0 {
b.Annotations = make(map[string]string, len(entries)) b.Annotations = make(map[string]string, len(entries))
@ -212,7 +212,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithAnnotations(entries map[string
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field. // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *NodeResourceSliceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
for i := range values { for i := range values {
if values[i] == nil { if values[i] == nil {
@ -226,7 +226,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithOwnerReferences(values ...*v1.
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field. // If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *NodeResourceSliceApplyConfiguration) WithFinalizers(values ...string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithFinalizers(values ...string) *ResourceSliceApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists() b.ensureObjectMetaApplyConfigurationExists()
for i := range values { for i := range values {
b.Finalizers = append(b.Finalizers, values[i]) b.Finalizers = append(b.Finalizers, values[i])
@ -234,7 +234,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithFinalizers(values ...string) *
return b return b
} }
func (b *NodeResourceSliceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { func (b *ResourceSliceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil { if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
} }
@ -243,7 +243,7 @@ func (b *NodeResourceSliceApplyConfiguration) ensureObjectMetaApplyConfiguration
// WithNodeName sets the NodeName field in the declarative configuration to the given value // WithNodeName sets the NodeName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the NodeName field is set to the value of the last call. // If called multiple times, the NodeName field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithNodeName(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithNodeName(value string) *ResourceSliceApplyConfiguration {
b.NodeName = &value b.NodeName = &value
return b return b
} }
@ -251,7 +251,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithNodeName(value string) *NodeRe
// WithDriverName sets the DriverName field in the declarative configuration to the given value // WithDriverName sets the DriverName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DriverName field is set to the value of the last call. // If called multiple times, the DriverName field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithDriverName(value string) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithDriverName(value string) *ResourceSliceApplyConfiguration {
b.DriverName = &value b.DriverName = &value
return b return b
} }
@ -259,7 +259,7 @@ func (b *NodeResourceSliceApplyConfiguration) WithDriverName(value string) *Node
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value // WithNamedResources sets the NamedResources field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the NamedResources field is set to the value of the last call. // If called multiple times, the NamedResources field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceSliceApplyConfiguration { func (b *ResourceSliceApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *ResourceSliceApplyConfiguration {
b.NamedResources = value b.NamedResources = value
return b return b
} }

View File

@ -1553,8 +1553,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha2.NamedResourcesStringSliceApplyConfiguration{} return &resourcev1alpha2.NamedResourcesStringSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceModel"): case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceModel"):
return &resourcev1alpha2.NodeResourceModelApplyConfiguration{} return &resourcev1alpha2.NodeResourceModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceSlice"):
return &resourcev1alpha2.NodeResourceSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"): case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"):
return &resourcev1alpha2.PodSchedulingContextApplyConfiguration{} return &resourcev1alpha2.PodSchedulingContextApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContextSpec"): case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContextSpec"):
@ -1595,6 +1593,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha2.ResourceRequestApplyConfiguration{} return &resourcev1alpha2.ResourceRequestApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequestModel"): case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequestModel"):
return &resourcev1alpha2.ResourceRequestModelApplyConfiguration{} return &resourcev1alpha2.ResourceRequestModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceSlice"):
return &resourcev1alpha2.ResourceSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("StructuredResourceHandle"): case v1alpha2.SchemeGroupVersion.WithKind("StructuredResourceHandle"):
return &resourcev1alpha2.StructuredResourceHandleApplyConfiguration{} return &resourcev1alpha2.StructuredResourceHandleApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("VendorParameters"): case v1alpha2.SchemeGroupVersion.WithKind("VendorParameters"):

View File

@ -362,8 +362,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil
// Group=resource.k8s.io, Version=v1alpha2 // Group=resource.k8s.io, Version=v1alpha2
case v1alpha2.SchemeGroupVersion.WithResource("noderesourceslices"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().NodeResourceSlices().Informer()}, nil
case v1alpha2.SchemeGroupVersion.WithResource("podschedulingcontexts"): case v1alpha2.SchemeGroupVersion.WithResource("podschedulingcontexts"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().PodSchedulingContexts().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().PodSchedulingContexts().Informer()}, nil
case v1alpha2.SchemeGroupVersion.WithResource("resourceclaims"): case v1alpha2.SchemeGroupVersion.WithResource("resourceclaims"):
@ -376,6 +374,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().ResourceClasses().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().ResourceClasses().Informer()}, nil
case v1alpha2.SchemeGroupVersion.WithResource("resourceclassparameters"): case v1alpha2.SchemeGroupVersion.WithResource("resourceclassparameters"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().ResourceClassParameters().Informer()}, nil return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().ResourceClassParameters().Informer()}, nil
case v1alpha2.SchemeGroupVersion.WithResource("resourceslices"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha2().ResourceSlices().Informer()}, nil
// Group=scheduling.k8s.io, Version=v1 // Group=scheduling.k8s.io, Version=v1
case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"):

View File

@ -24,8 +24,6 @@ import (
// Interface provides access to all the informers in this group version. // Interface provides access to all the informers in this group version.
type Interface interface { type Interface interface {
// NodeResourceSlices returns a NodeResourceSliceInformer.
NodeResourceSlices() NodeResourceSliceInformer
// PodSchedulingContexts returns a PodSchedulingContextInformer. // PodSchedulingContexts returns a PodSchedulingContextInformer.
PodSchedulingContexts() PodSchedulingContextInformer PodSchedulingContexts() PodSchedulingContextInformer
// ResourceClaims returns a ResourceClaimInformer. // ResourceClaims returns a ResourceClaimInformer.
@ -38,6 +36,8 @@ type Interface interface {
ResourceClasses() ResourceClassInformer ResourceClasses() ResourceClassInformer
// ResourceClassParameters returns a ResourceClassParametersInformer. // ResourceClassParameters returns a ResourceClassParametersInformer.
ResourceClassParameters() ResourceClassParametersInformer ResourceClassParameters() ResourceClassParametersInformer
// ResourceSlices returns a ResourceSliceInformer.
ResourceSlices() ResourceSliceInformer
} }
type version struct { type version struct {
@ -51,11 +51,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
} }
// NodeResourceSlices returns a NodeResourceSliceInformer.
func (v *version) NodeResourceSlices() NodeResourceSliceInformer {
return &nodeResourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// PodSchedulingContexts returns a PodSchedulingContextInformer. // PodSchedulingContexts returns a PodSchedulingContextInformer.
func (v *version) PodSchedulingContexts() PodSchedulingContextInformer { func (v *version) PodSchedulingContexts() PodSchedulingContextInformer {
return &podSchedulingContextInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &podSchedulingContextInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@ -85,3 +80,8 @@ func (v *version) ResourceClasses() ResourceClassInformer {
func (v *version) ResourceClassParameters() ResourceClassParametersInformer { func (v *version) ResourceClassParameters() ResourceClassParametersInformer {
return &resourceClassParametersInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} return &resourceClassParametersInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} }
// ResourceSlices returns a ResourceSliceInformer.
func (v *version) ResourceSlices() ResourceSliceInformer {
return &resourceSliceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

View File

@ -32,58 +32,58 @@ import (
cache "k8s.io/client-go/tools/cache" cache "k8s.io/client-go/tools/cache"
) )
// NodeResourceSliceInformer provides access to a shared informer and lister for // ResourceSliceInformer provides access to a shared informer and lister for
// NodeResourceSlices. // ResourceSlices.
type NodeResourceSliceInformer interface { type ResourceSliceInformer interface {
Informer() cache.SharedIndexInformer Informer() cache.SharedIndexInformer
Lister() v1alpha2.NodeResourceSliceLister Lister() v1alpha2.ResourceSliceLister
} }
type nodeResourceSliceInformer struct { type resourceSliceInformer struct {
factory internalinterfaces.SharedInformerFactory factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc tweakListOptions internalinterfaces.TweakListOptionsFunc
} }
// NewNodeResourceSliceInformer constructs a new informer for NodeResourceSlice type. // NewResourceSliceInformer constructs a new informer for ResourceSlice type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent // Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. // one. This reduces memory footprint and number of connections to the server.
func NewNodeResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredNodeResourceSliceInformer(client, resyncPeriod, indexers, nil) return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil)
} }
// NewFilteredNodeResourceSliceInformer constructs a new informer for NodeResourceSlice type. // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent // Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server. // one. This reduces memory footprint and number of connections to the server.
func NewFilteredNodeResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer( return cache.NewSharedIndexInformer(
&cache.ListWatch{ &cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) { ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil { if tweakListOptions != nil {
tweakListOptions(&options) tweakListOptions(&options)
} }
return client.ResourceV1alpha2().NodeResourceSlices().List(context.TODO(), options) return client.ResourceV1alpha2().ResourceSlices().List(context.TODO(), options)
}, },
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil { if tweakListOptions != nil {
tweakListOptions(&options) tweakListOptions(&options)
} }
return client.ResourceV1alpha2().NodeResourceSlices().Watch(context.TODO(), options) return client.ResourceV1alpha2().ResourceSlices().Watch(context.TODO(), options)
}, },
}, },
&resourcev1alpha2.NodeResourceSlice{}, &resourcev1alpha2.ResourceSlice{},
resyncPeriod, resyncPeriod,
indexers, indexers,
) )
} }
func (f *nodeResourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredNodeResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
} }
func (f *nodeResourceSliceInformer) Informer() cache.SharedIndexInformer { func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&resourcev1alpha2.NodeResourceSlice{}, f.defaultInformer) return f.factory.InformerFor(&resourcev1alpha2.ResourceSlice{}, f.defaultInformer)
} }
func (f *nodeResourceSliceInformer) Lister() v1alpha2.NodeResourceSliceLister { func (f *resourceSliceInformer) Lister() v1alpha2.ResourceSliceLister {
return v1alpha2.NewNodeResourceSliceLister(f.Informer().GetIndexer()) return v1alpha2.NewResourceSliceLister(f.Informer().GetIndexer())
} }

View File

@ -1,145 +0,0 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
json "encoding/json"
"fmt"
v1alpha2 "k8s.io/api/resource/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
resourcev1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
testing "k8s.io/client-go/testing"
)
// FakeNodeResourceSlices implements NodeResourceSliceInterface
type FakeNodeResourceSlices struct {
Fake *FakeResourceV1alpha2
}
var noderesourceslicesResource = v1alpha2.SchemeGroupVersion.WithResource("noderesourceslices")
var noderesourceslicesKind = v1alpha2.SchemeGroupVersion.WithKind("NodeResourceSlice")
// Get takes name of the nodeResourceSlice, and returns the corresponding nodeResourceSlice object, and an error if there is any.
func (c *FakeNodeResourceSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.NodeResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(noderesourceslicesResource, name), &v1alpha2.NodeResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.NodeResourceSlice), err
}
// List takes label and field selectors, and returns the list of NodeResourceSlices that match those selectors.
func (c *FakeNodeResourceSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.NodeResourceSliceList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(noderesourceslicesResource, noderesourceslicesKind, opts), &v1alpha2.NodeResourceSliceList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.NodeResourceSliceList{ListMeta: obj.(*v1alpha2.NodeResourceSliceList).ListMeta}
for _, item := range obj.(*v1alpha2.NodeResourceSliceList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested nodeResourceSlices.
func (c *FakeNodeResourceSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(noderesourceslicesResource, opts))
}
// Create takes the representation of a nodeResourceSlice and creates it. Returns the server's representation of the nodeResourceSlice, and an error, if there is any.
func (c *FakeNodeResourceSlices) Create(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.CreateOptions) (result *v1alpha2.NodeResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(noderesourceslicesResource, nodeResourceSlice), &v1alpha2.NodeResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.NodeResourceSlice), err
}
// Update takes the representation of a nodeResourceSlice and updates it. Returns the server's representation of the nodeResourceSlice, and an error, if there is any.
func (c *FakeNodeResourceSlices) Update(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.UpdateOptions) (result *v1alpha2.NodeResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(noderesourceslicesResource, nodeResourceSlice), &v1alpha2.NodeResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.NodeResourceSlice), err
}
// Delete takes name of the nodeResourceSlice and deletes it. Returns an error if one occurs.
func (c *FakeNodeResourceSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(noderesourceslicesResource, name, opts), &v1alpha2.NodeResourceSlice{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeNodeResourceSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(noderesourceslicesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha2.NodeResourceSliceList{})
return err
}
// Patch applies the patch and returns the patched nodeResourceSlice.
func (c *FakeNodeResourceSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.NodeResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(noderesourceslicesResource, name, pt, data, subresources...), &v1alpha2.NodeResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.NodeResourceSlice), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied nodeResourceSlice.
func (c *FakeNodeResourceSlices) Apply(ctx context.Context, nodeResourceSlice *resourcev1alpha2.NodeResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.NodeResourceSlice, err error) {
if nodeResourceSlice == nil {
return nil, fmt.Errorf("nodeResourceSlice provided to Apply must not be nil")
}
data, err := json.Marshal(nodeResourceSlice)
if err != nil {
return nil, err
}
name := nodeResourceSlice.Name
if name == nil {
return nil, fmt.Errorf("nodeResourceSlice.Name must be provided to Apply")
}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(noderesourceslicesResource, *name, types.ApplyPatchType, data), &v1alpha2.NodeResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.NodeResourceSlice), err
}

View File

@ -28,10 +28,6 @@ type FakeResourceV1alpha2 struct {
*testing.Fake *testing.Fake
} }
func (c *FakeResourceV1alpha2) NodeResourceSlices() v1alpha2.NodeResourceSliceInterface {
return &FakeNodeResourceSlices{c}
}
func (c *FakeResourceV1alpha2) PodSchedulingContexts(namespace string) v1alpha2.PodSchedulingContextInterface { func (c *FakeResourceV1alpha2) PodSchedulingContexts(namespace string) v1alpha2.PodSchedulingContextInterface {
return &FakePodSchedulingContexts{c, namespace} return &FakePodSchedulingContexts{c, namespace}
} }
@ -56,6 +52,10 @@ func (c *FakeResourceV1alpha2) ResourceClassParameters(namespace string) v1alpha
return &FakeResourceClassParameters{c, namespace} return &FakeResourceClassParameters{c, namespace}
} }
func (c *FakeResourceV1alpha2) ResourceSlices() v1alpha2.ResourceSliceInterface {
return &FakeResourceSlices{c}
}
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation. // with API server by this client implementation.
func (c *FakeResourceV1alpha2) RESTClient() rest.Interface { func (c *FakeResourceV1alpha2) RESTClient() rest.Interface {

View File

@ -0,0 +1,145 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
json "encoding/json"
"fmt"
v1alpha2 "k8s.io/api/resource/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
resourcev1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
testing "k8s.io/client-go/testing"
)
// FakeResourceSlices implements ResourceSliceInterface
type FakeResourceSlices struct {
Fake *FakeResourceV1alpha2
}
var resourceslicesResource = v1alpha2.SchemeGroupVersion.WithResource("resourceslices")
var resourceslicesKind = v1alpha2.SchemeGroupVersion.WithKind("ResourceSlice")
// Get takes name of the resourceSlice, and returns the corresponding resourceSlice object, and an error if there is any.
func (c *FakeResourceSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(resourceslicesResource, name), &v1alpha2.ResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.ResourceSlice), err
}
// List takes label and field selectors, and returns the list of ResourceSlices that match those selectors.
func (c *FakeResourceSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ResourceSliceList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(resourceslicesResource, resourceslicesKind, opts), &v1alpha2.ResourceSliceList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha2.ResourceSliceList{ListMeta: obj.(*v1alpha2.ResourceSliceList).ListMeta}
for _, item := range obj.(*v1alpha2.ResourceSliceList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested resourceSlices.
func (c *FakeResourceSlices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(resourceslicesResource, opts))
}
// Create takes the representation of a resourceSlice and creates it. Returns the server's representation of the resourceSlice, and an error, if there is any.
func (c *FakeResourceSlices) Create(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.CreateOptions) (result *v1alpha2.ResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(resourceslicesResource, resourceSlice), &v1alpha2.ResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.ResourceSlice), err
}
// Update takes the representation of a resourceSlice and updates it. Returns the server's representation of the resourceSlice, and an error, if there is any.
func (c *FakeResourceSlices) Update(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.UpdateOptions) (result *v1alpha2.ResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(resourceslicesResource, resourceSlice), &v1alpha2.ResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.ResourceSlice), err
}
// Delete takes name of the resourceSlice and deletes it. Returns an error if one occurs.
func (c *FakeResourceSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(resourceslicesResource, name, opts), &v1alpha2.ResourceSlice{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeResourceSlices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(resourceslicesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha2.ResourceSliceList{})
return err
}
// Patch applies the patch and returns the patched resourceSlice.
func (c *FakeResourceSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ResourceSlice, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(resourceslicesResource, name, pt, data, subresources...), &v1alpha2.ResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.ResourceSlice), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied resourceSlice.
func (c *FakeResourceSlices) Apply(ctx context.Context, resourceSlice *resourcev1alpha2.ResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceSlice, err error) {
if resourceSlice == nil {
return nil, fmt.Errorf("resourceSlice provided to Apply must not be nil")
}
data, err := json.Marshal(resourceSlice)
if err != nil {
return nil, err
}
name := resourceSlice.Name
if name == nil {
return nil, fmt.Errorf("resourceSlice.Name must be provided to Apply")
}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(resourceslicesResource, *name, types.ApplyPatchType, data), &v1alpha2.ResourceSlice{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha2.ResourceSlice), err
}

View File

@ -18,8 +18,6 @@ limitations under the License.
package v1alpha2 package v1alpha2
type NodeResourceSliceExpansion interface{}
type PodSchedulingContextExpansion interface{} type PodSchedulingContextExpansion interface{}
type ResourceClaimExpansion interface{} type ResourceClaimExpansion interface{}
@ -31,3 +29,5 @@ type ResourceClaimTemplateExpansion interface{}
type ResourceClassExpansion interface{} type ResourceClassExpansion interface{}
type ResourceClassParametersExpansion interface{} type ResourceClassParametersExpansion interface{}
type ResourceSliceExpansion interface{}

View File

@ -1,197 +0,0 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha2
import (
"context"
json "encoding/json"
"fmt"
"time"
v1alpha2 "k8s.io/api/resource/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
resourcev1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// NodeResourceSlicesGetter has a method to return a NodeResourceSliceInterface.
// A group's client should implement this interface.
type NodeResourceSlicesGetter interface {
NodeResourceSlices() NodeResourceSliceInterface
}
// NodeResourceSliceInterface has methods to work with NodeResourceSlice resources.
type NodeResourceSliceInterface interface {
Create(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.CreateOptions) (*v1alpha2.NodeResourceSlice, error)
Update(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.UpdateOptions) (*v1alpha2.NodeResourceSlice, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.NodeResourceSlice, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.NodeResourceSliceList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.NodeResourceSlice, err error)
Apply(ctx context.Context, nodeResourceSlice *resourcev1alpha2.NodeResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.NodeResourceSlice, err error)
NodeResourceSliceExpansion
}
// nodeResourceSlices implements NodeResourceSliceInterface
type nodeResourceSlices struct {
client rest.Interface
}
// newNodeResourceSlices returns a NodeResourceSlices
func newNodeResourceSlices(c *ResourceV1alpha2Client) *nodeResourceSlices {
return &nodeResourceSlices{
client: c.RESTClient(),
}
}
// Get takes name of the nodeResourceSlice, and returns the corresponding nodeResourceSlice object, and an error if there is any.
func (c *nodeResourceSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.NodeResourceSlice, err error) {
result = &v1alpha2.NodeResourceSlice{}
err = c.client.Get().
Resource("noderesourceslices").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of NodeResourceSlices that match those selectors.
func (c *nodeResourceSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.NodeResourceSliceList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha2.NodeResourceSliceList{}
err = c.client.Get().
Resource("noderesourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested nodeResourceSlices.
func (c *nodeResourceSlices) 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("noderesourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a nodeResourceSlice and creates it. Returns the server's representation of the nodeResourceSlice, and an error, if there is any.
func (c *nodeResourceSlices) Create(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.CreateOptions) (result *v1alpha2.NodeResourceSlice, err error) {
result = &v1alpha2.NodeResourceSlice{}
err = c.client.Post().
Resource("noderesourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodeResourceSlice).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a nodeResourceSlice and updates it. Returns the server's representation of the nodeResourceSlice, and an error, if there is any.
func (c *nodeResourceSlices) Update(ctx context.Context, nodeResourceSlice *v1alpha2.NodeResourceSlice, opts v1.UpdateOptions) (result *v1alpha2.NodeResourceSlice, err error) {
result = &v1alpha2.NodeResourceSlice{}
err = c.client.Put().
Resource("noderesourceslices").
Name(nodeResourceSlice.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodeResourceSlice).
Do(ctx).
Into(result)
return
}
// Delete takes name of the nodeResourceSlice and deletes it. Returns an error if one occurs.
func (c *nodeResourceSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("noderesourceslices").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *nodeResourceSlices) 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("noderesourceslices").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched nodeResourceSlice.
func (c *nodeResourceSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.NodeResourceSlice, err error) {
result = &v1alpha2.NodeResourceSlice{}
err = c.client.Patch(pt).
Resource("noderesourceslices").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
// Apply takes the given apply declarative configuration, applies it and returns the applied nodeResourceSlice.
func (c *nodeResourceSlices) Apply(ctx context.Context, nodeResourceSlice *resourcev1alpha2.NodeResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.NodeResourceSlice, err error) {
if nodeResourceSlice == nil {
return nil, fmt.Errorf("nodeResourceSlice provided to Apply must not be nil")
}
patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(nodeResourceSlice)
if err != nil {
return nil, err
}
name := nodeResourceSlice.Name
if name == nil {
return nil, fmt.Errorf("nodeResourceSlice.Name must be provided to Apply")
}
result = &v1alpha2.NodeResourceSlice{}
err = c.client.Patch(types.ApplyPatchType).
Resource("noderesourceslices").
Name(*name).
VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -28,13 +28,13 @@ import (
type ResourceV1alpha2Interface interface { type ResourceV1alpha2Interface interface {
RESTClient() rest.Interface RESTClient() rest.Interface
NodeResourceSlicesGetter
PodSchedulingContextsGetter PodSchedulingContextsGetter
ResourceClaimsGetter ResourceClaimsGetter
ResourceClaimParametersGetter ResourceClaimParametersGetter
ResourceClaimTemplatesGetter ResourceClaimTemplatesGetter
ResourceClassesGetter ResourceClassesGetter
ResourceClassParametersGetter ResourceClassParametersGetter
ResourceSlicesGetter
} }
// ResourceV1alpha2Client is used to interact with features provided by the resource.k8s.io group. // ResourceV1alpha2Client is used to interact with features provided by the resource.k8s.io group.
@ -42,10 +42,6 @@ type ResourceV1alpha2Client struct {
restClient rest.Interface restClient rest.Interface
} }
func (c *ResourceV1alpha2Client) NodeResourceSlices() NodeResourceSliceInterface {
return newNodeResourceSlices(c)
}
func (c *ResourceV1alpha2Client) PodSchedulingContexts(namespace string) PodSchedulingContextInterface { func (c *ResourceV1alpha2Client) PodSchedulingContexts(namespace string) PodSchedulingContextInterface {
return newPodSchedulingContexts(c, namespace) return newPodSchedulingContexts(c, namespace)
} }
@ -70,6 +66,10 @@ func (c *ResourceV1alpha2Client) ResourceClassParameters(namespace string) Resou
return newResourceClassParameters(c, namespace) return newResourceClassParameters(c, namespace)
} }
func (c *ResourceV1alpha2Client) ResourceSlices() ResourceSliceInterface {
return newResourceSlices(c)
}
// NewForConfig creates a new ResourceV1alpha2Client for the given config. // NewForConfig creates a new ResourceV1alpha2Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c). // where httpClient was generated with rest.HTTPClientFor(c).

View File

@ -0,0 +1,197 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha2
import (
"context"
json "encoding/json"
"fmt"
"time"
v1alpha2 "k8s.io/api/resource/v1alpha2"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
resourcev1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// ResourceSlicesGetter has a method to return a ResourceSliceInterface.
// A group's client should implement this interface.
type ResourceSlicesGetter interface {
ResourceSlices() ResourceSliceInterface
}
// ResourceSliceInterface has methods to work with ResourceSlice resources.
type ResourceSliceInterface interface {
Create(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.CreateOptions) (*v1alpha2.ResourceSlice, error)
Update(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.UpdateOptions) (*v1alpha2.ResourceSlice, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.ResourceSlice, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.ResourceSliceList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ResourceSlice, err error)
Apply(ctx context.Context, resourceSlice *resourcev1alpha2.ResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceSlice, err error)
ResourceSliceExpansion
}
// resourceSlices implements ResourceSliceInterface
type resourceSlices struct {
client rest.Interface
}
// newResourceSlices returns a ResourceSlices
func newResourceSlices(c *ResourceV1alpha2Client) *resourceSlices {
return &resourceSlices{
client: c.RESTClient(),
}
}
// Get takes name of the resourceSlice, and returns the corresponding resourceSlice object, and an error if there is any.
func (c *resourceSlices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ResourceSlice, err error) {
result = &v1alpha2.ResourceSlice{}
err = c.client.Get().
Resource("resourceslices").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ResourceSlices that match those selectors.
func (c *resourceSlices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ResourceSliceList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha2.ResourceSliceList{}
err = c.client.Get().
Resource("resourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested resourceSlices.
func (c *resourceSlices) 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("resourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a resourceSlice and creates it. Returns the server's representation of the resourceSlice, and an error, if there is any.
func (c *resourceSlices) Create(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.CreateOptions) (result *v1alpha2.ResourceSlice, err error) {
result = &v1alpha2.ResourceSlice{}
err = c.client.Post().
Resource("resourceslices").
VersionedParams(&opts, scheme.ParameterCodec).
Body(resourceSlice).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a resourceSlice and updates it. Returns the server's representation of the resourceSlice, and an error, if there is any.
func (c *resourceSlices) Update(ctx context.Context, resourceSlice *v1alpha2.ResourceSlice, opts v1.UpdateOptions) (result *v1alpha2.ResourceSlice, err error) {
result = &v1alpha2.ResourceSlice{}
err = c.client.Put().
Resource("resourceslices").
Name(resourceSlice.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(resourceSlice).
Do(ctx).
Into(result)
return
}
// Delete takes name of the resourceSlice and deletes it. Returns an error if one occurs.
func (c *resourceSlices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("resourceslices").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *resourceSlices) 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("resourceslices").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched resourceSlice.
func (c *resourceSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ResourceSlice, err error) {
result = &v1alpha2.ResourceSlice{}
err = c.client.Patch(pt).
Resource("resourceslices").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
// Apply takes the given apply declarative configuration, applies it and returns the applied resourceSlice.
func (c *resourceSlices) Apply(ctx context.Context, resourceSlice *resourcev1alpha2.ResourceSliceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceSlice, err error) {
if resourceSlice == nil {
return nil, fmt.Errorf("resourceSlice provided to Apply must not be nil")
}
patchOpts := opts.ToPatchOptions()
data, err := json.Marshal(resourceSlice)
if err != nil {
return nil, err
}
name := resourceSlice.Name
if name == nil {
return nil, fmt.Errorf("resourceSlice.Name must be provided to Apply")
}
result = &v1alpha2.ResourceSlice{}
err = c.client.Patch(types.ApplyPatchType).
Resource("resourceslices").
Name(*name).
VersionedParams(&patchOpts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -18,10 +18,6 @@ limitations under the License.
package v1alpha2 package v1alpha2
// NodeResourceSliceListerExpansion allows custom methods to be added to
// NodeResourceSliceLister.
type NodeResourceSliceListerExpansion interface{}
// PodSchedulingContextListerExpansion allows custom methods to be added to // PodSchedulingContextListerExpansion allows custom methods to be added to
// PodSchedulingContextLister. // PodSchedulingContextLister.
type PodSchedulingContextListerExpansion interface{} type PodSchedulingContextListerExpansion interface{}
@ -65,3 +61,7 @@ type ResourceClassParametersListerExpansion interface{}
// ResourceClassParametersNamespaceListerExpansion allows custom methods to be added to // ResourceClassParametersNamespaceListerExpansion allows custom methods to be added to
// ResourceClassParametersNamespaceLister. // ResourceClassParametersNamespaceLister.
type ResourceClassParametersNamespaceListerExpansion interface{} type ResourceClassParametersNamespaceListerExpansion interface{}
// ResourceSliceListerExpansion allows custom methods to be added to
// ResourceSliceLister.
type ResourceSliceListerExpansion interface{}

View File

@ -1,68 +0,0 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// NodeResourceSliceLister helps list NodeResourceSlices.
// All objects returned here must be treated as read-only.
type NodeResourceSliceLister interface {
// List lists all NodeResourceSlices in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha2.NodeResourceSlice, err error)
// Get retrieves the NodeResourceSlice from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha2.NodeResourceSlice, error)
NodeResourceSliceListerExpansion
}
// nodeResourceSliceLister implements the NodeResourceSliceLister interface.
type nodeResourceSliceLister struct {
indexer cache.Indexer
}
// NewNodeResourceSliceLister returns a new NodeResourceSliceLister.
func NewNodeResourceSliceLister(indexer cache.Indexer) NodeResourceSliceLister {
return &nodeResourceSliceLister{indexer: indexer}
}
// List lists all NodeResourceSlices in the indexer.
func (s *nodeResourceSliceLister) List(selector labels.Selector) (ret []*v1alpha2.NodeResourceSlice, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha2.NodeResourceSlice))
})
return ret, err
}
// Get retrieves the NodeResourceSlice from the index for a given name.
func (s *nodeResourceSliceLister) Get(name string) (*v1alpha2.NodeResourceSlice, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha2.Resource("noderesourceslice"), name)
}
return obj.(*v1alpha2.NodeResourceSlice), nil
}

View File

@ -0,0 +1,68 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ResourceSliceLister helps list ResourceSlices.
// All objects returned here must be treated as read-only.
type ResourceSliceLister interface {
// List lists all ResourceSlices in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha2.ResourceSlice, err error)
// Get retrieves the ResourceSlice from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha2.ResourceSlice, error)
ResourceSliceListerExpansion
}
// resourceSliceLister implements the ResourceSliceLister interface.
type resourceSliceLister struct {
indexer cache.Indexer
}
// NewResourceSliceLister returns a new ResourceSliceLister.
func NewResourceSliceLister(indexer cache.Indexer) ResourceSliceLister {
return &resourceSliceLister{indexer: indexer}
}
// List lists all ResourceSlices in the indexer.
func (s *resourceSliceLister) List(selector labels.Selector) (ret []*v1alpha2.ResourceSlice, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha2.ResourceSlice))
})
return ret, err
}
// Get retrieves the ResourceSlice from the index for a given name.
func (s *resourceSliceLister) Get(name string) (*v1alpha2.ResourceSlice, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha2.Resource("resourceslice"), name)
}
return obj.(*v1alpha2.ResourceSlice), nil
}