Merge pull request #128586 from mortent/DRAPrioritizedList

Prioritized Alternatives in Device Requests

Kubernetes-commit: 9d45ea8b9d0be4f2f90159ff272851b8e985c904
This commit is contained in:
Kubernetes Publisher 2025-03-06 21:01:44 -08:00
commit ca10b28dd3
8 changed files with 264 additions and 6 deletions

View File

@ -12668,6 +12668,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: firstAvailable
type:
list:
elementType:
namedType: io.k8s.api.resource.v1alpha3.DeviceSubRequest
elementRelationship: atomic
- name: name
type:
scalar: string
@ -12706,6 +12712,29 @@ var schemaYAML = typed.YAMLObject(`types:
- name: cel
type:
namedType: io.k8s.api.resource.v1alpha3.CELDeviceSelector
- name: io.k8s.api.resource.v1alpha3.DeviceSubRequest
map:
fields:
- name: allocationMode
type:
scalar: string
- name: count
type:
scalar: numeric
- name: deviceClassName
type:
scalar: string
default: ""
- name: name
type:
scalar: string
default: ""
- name: selectors
type:
list:
elementType:
namedType: io.k8s.api.resource.v1alpha3.DeviceSelector
elementRelationship: atomic
- name: io.k8s.api.resource.v1alpha3.NetworkDeviceData
map:
fields:
@ -13107,6 +13136,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: firstAvailable
type:
list:
elementType:
namedType: io.k8s.api.resource.v1beta1.DeviceSubRequest
elementRelationship: atomic
- name: name
type:
scalar: string
@ -13145,6 +13180,29 @@ var schemaYAML = typed.YAMLObject(`types:
- name: cel
type:
namedType: io.k8s.api.resource.v1beta1.CELDeviceSelector
- name: io.k8s.api.resource.v1beta1.DeviceSubRequest
map:
fields:
- name: allocationMode
type:
scalar: string
- name: count
type:
scalar: numeric
- name: deviceClassName
type:
scalar: string
default: ""
- name: name
type:
scalar: string
default: ""
- name: selectors
type:
list:
elementType:
namedType: io.k8s.api.resource.v1beta1.DeviceSelector
elementRelationship: atomic
- name: io.k8s.api.resource.v1beta1.NetworkDeviceData
map:
fields:

View File

@ -31,6 +31,7 @@ type DeviceRequestApplyConfiguration struct {
AllocationMode *resourcev1alpha3.DeviceAllocationMode `json:"allocationMode,omitempty"`
Count *int64 `json:"count,omitempty"`
AdminAccess *bool `json:"adminAccess,omitempty"`
FirstAvailable []DeviceSubRequestApplyConfiguration `json:"firstAvailable,omitempty"`
}
// DeviceRequestApplyConfiguration constructs a declarative configuration of the DeviceRequest type for use with
@ -91,3 +92,16 @@ func (b *DeviceRequestApplyConfiguration) WithAdminAccess(value bool) *DeviceReq
b.AdminAccess = &value
return b
}
// WithFirstAvailable adds the given value to the FirstAvailable field in the declarative configuration
// 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 FirstAvailable field.
func (b *DeviceRequestApplyConfiguration) WithFirstAvailable(values ...*DeviceSubRequestApplyConfiguration) *DeviceRequestApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithFirstAvailable")
}
b.FirstAvailable = append(b.FirstAvailable, *values[i])
}
return b
}

View File

@ -0,0 +1,84 @@
/*
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 applyconfiguration-gen. DO NOT EDIT.
package v1alpha3
import (
resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
)
// DeviceSubRequestApplyConfiguration represents a declarative configuration of the DeviceSubRequest type for use
// with apply.
type DeviceSubRequestApplyConfiguration struct {
Name *string `json:"name,omitempty"`
DeviceClassName *string `json:"deviceClassName,omitempty"`
Selectors []DeviceSelectorApplyConfiguration `json:"selectors,omitempty"`
AllocationMode *resourcev1alpha3.DeviceAllocationMode `json:"allocationMode,omitempty"`
Count *int64 `json:"count,omitempty"`
}
// DeviceSubRequestApplyConfiguration constructs a declarative configuration of the DeviceSubRequest type for use with
// apply.
func DeviceSubRequest() *DeviceSubRequestApplyConfiguration {
return &DeviceSubRequestApplyConfiguration{}
}
// 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.
// If called multiple times, the Name field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithName(value string) *DeviceSubRequestApplyConfiguration {
b.Name = &value
return b
}
// WithDeviceClassName sets the DeviceClassName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeviceClassName field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithDeviceClassName(value string) *DeviceSubRequestApplyConfiguration {
b.DeviceClassName = &value
return b
}
// WithSelectors adds the given value to the Selectors field in the declarative configuration
// 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 Selectors field.
func (b *DeviceSubRequestApplyConfiguration) WithSelectors(values ...*DeviceSelectorApplyConfiguration) *DeviceSubRequestApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithSelectors")
}
b.Selectors = append(b.Selectors, *values[i])
}
return b
}
// WithAllocationMode sets the AllocationMode field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocationMode field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithAllocationMode(value resourcev1alpha3.DeviceAllocationMode) *DeviceSubRequestApplyConfiguration {
b.AllocationMode = &value
return b
}
// WithCount sets the Count field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Count field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithCount(value int64) *DeviceSubRequestApplyConfiguration {
b.Count = &value
return b
}

View File

@ -31,6 +31,7 @@ type DeviceRequestApplyConfiguration struct {
AllocationMode *resourcev1beta1.DeviceAllocationMode `json:"allocationMode,omitempty"`
Count *int64 `json:"count,omitempty"`
AdminAccess *bool `json:"adminAccess,omitempty"`
FirstAvailable []DeviceSubRequestApplyConfiguration `json:"firstAvailable,omitempty"`
}
// DeviceRequestApplyConfiguration constructs a declarative configuration of the DeviceRequest type for use with
@ -91,3 +92,16 @@ func (b *DeviceRequestApplyConfiguration) WithAdminAccess(value bool) *DeviceReq
b.AdminAccess = &value
return b
}
// WithFirstAvailable adds the given value to the FirstAvailable field in the declarative configuration
// 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 FirstAvailable field.
func (b *DeviceRequestApplyConfiguration) WithFirstAvailable(values ...*DeviceSubRequestApplyConfiguration) *DeviceRequestApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithFirstAvailable")
}
b.FirstAvailable = append(b.FirstAvailable, *values[i])
}
return b
}

View File

@ -0,0 +1,84 @@
/*
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 applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
resourcev1beta1 "k8s.io/api/resource/v1beta1"
)
// DeviceSubRequestApplyConfiguration represents a declarative configuration of the DeviceSubRequest type for use
// with apply.
type DeviceSubRequestApplyConfiguration struct {
Name *string `json:"name,omitempty"`
DeviceClassName *string `json:"deviceClassName,omitempty"`
Selectors []DeviceSelectorApplyConfiguration `json:"selectors,omitempty"`
AllocationMode *resourcev1beta1.DeviceAllocationMode `json:"allocationMode,omitempty"`
Count *int64 `json:"count,omitempty"`
}
// DeviceSubRequestApplyConfiguration constructs a declarative configuration of the DeviceSubRequest type for use with
// apply.
func DeviceSubRequest() *DeviceSubRequestApplyConfiguration {
return &DeviceSubRequestApplyConfiguration{}
}
// 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.
// If called multiple times, the Name field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithName(value string) *DeviceSubRequestApplyConfiguration {
b.Name = &value
return b
}
// WithDeviceClassName sets the DeviceClassName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeviceClassName field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithDeviceClassName(value string) *DeviceSubRequestApplyConfiguration {
b.DeviceClassName = &value
return b
}
// WithSelectors adds the given value to the Selectors field in the declarative configuration
// 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 Selectors field.
func (b *DeviceSubRequestApplyConfiguration) WithSelectors(values ...*DeviceSelectorApplyConfiguration) *DeviceSubRequestApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithSelectors")
}
b.Selectors = append(b.Selectors, *values[i])
}
return b
}
// WithAllocationMode sets the AllocationMode field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the AllocationMode field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithAllocationMode(value resourcev1beta1.DeviceAllocationMode) *DeviceSubRequestApplyConfiguration {
b.AllocationMode = &value
return b
}
// WithCount sets the Count field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Count field is set to the value of the last call.
func (b *DeviceSubRequestApplyConfiguration) WithCount(value int64) *DeviceSubRequestApplyConfiguration {
b.Count = &value
return b
}

View File

@ -1630,6 +1630,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha3.DeviceRequestAllocationResultApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("DeviceSelector"):
return &resourcev1alpha3.DeviceSelectorApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("DeviceSubRequest"):
return &resourcev1alpha3.DeviceSubRequestApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("NetworkDeviceData"):
return &resourcev1alpha3.NetworkDeviceDataApplyConfiguration{}
case v1alpha3.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):
@ -1692,6 +1694,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsresourcev1beta1.DeviceRequestAllocationResultApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceSelector"):
return &applyconfigurationsresourcev1beta1.DeviceSelectorApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("DeviceSubRequest"):
return &applyconfigurationsresourcev1beta1.DeviceSubRequestApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("NetworkDeviceData"):
return &applyconfigurationsresourcev1beta1.NetworkDeviceDataApplyConfiguration{}
case resourcev1beta1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"):

4
go.mod
View File

@ -26,8 +26,8 @@ require (
golang.org/x/time v0.7.0
google.golang.org/protobuf v1.35.2
gopkg.in/evanphx/json-patch.v4 v4.12.0
k8s.io/api v0.0.0-20250302000304-d98e88306c64
k8s.io/apimachinery v0.0.0-20250302000037-4e966741ac72
k8s.io/api v0.0.0-20250307053018-84fcd81bee60
k8s.io/apimachinery v0.0.0-20250306085752-a3f7d4eded06
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738

8
go.sum
View File

@ -148,10 +148,10 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20250302000304-d98e88306c64 h1:usPcU79ne5EPNj5qlw51vCMZrDLsNhute8ORJB5HkGA=
k8s.io/api v0.0.0-20250302000304-d98e88306c64/go.mod h1:TbBpVuQjoXdOhqO78T/K+NHq7MV5uCp3fUKjTS5yvCs=
k8s.io/apimachinery v0.0.0-20250302000037-4e966741ac72 h1:+t1A927okXr9FlNuKlrR53bLcTNQekdmse/RXi06fV8=
k8s.io/apimachinery v0.0.0-20250302000037-4e966741ac72/go.mod h1:0rVRgdlgja0MQ+SYCognm5pRNteQOvhHAsDpKOs48GU=
k8s.io/api v0.0.0-20250307053018-84fcd81bee60 h1:5w11QoDvikZvD0aqRSNq5Oq69zco5d2A/b/qt6/XqV8=
k8s.io/api v0.0.0-20250307053018-84fcd81bee60/go.mod h1:G18UCv44PFPN4QtOrDTocD/18UTFN7LHvSxz0SmxMvI=
k8s.io/apimachinery v0.0.0-20250306085752-a3f7d4eded06 h1:Q+BA4tyKlrCyXCHNHhiDIxMYz7JWeybRTlXmJeGvofY=
k8s.io/apimachinery v0.0.0-20250306085752-a3f7d4eded06/go.mod h1:0rVRgdlgja0MQ+SYCognm5pRNteQOvhHAsDpKOs48GU=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 h1:hcha5B1kVACrLujCKLbr8XWMxCxzQx42DY8QKYJrDLg=