mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Update AllocationResult and ResourceHandle for resource.k8s.io/v1alpha2
This implements the change outlined in the following KEP update: https://github.com/kubernetes/enhancements/pull/3802 Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
e8acfc45ba
commit
53dda4ffe2
@ -97,9 +97,9 @@ type ResourceClaimStatus struct {
|
|||||||
// +optional
|
// +optional
|
||||||
DriverName string
|
DriverName string
|
||||||
|
|
||||||
// Allocation is set by the resource driver once a resource has been
|
// Allocation is set by the resource driver once a resource or set of
|
||||||
// allocated successfully. If this is not specified, the resource is
|
// resources has been allocated successfully. If this is not specified, the
|
||||||
// not yet allocated.
|
// resources have not been allocated yet.
|
||||||
// +optional
|
// +optional
|
||||||
Allocation *AllocationResult
|
Allocation *AllocationResult
|
||||||
|
|
||||||
@ -128,21 +128,28 @@ type ResourceClaimStatus struct {
|
|||||||
// claim.status.reservedFor.
|
// claim.status.reservedFor.
|
||||||
const ResourceClaimReservedForMaxSize = 32
|
const ResourceClaimReservedForMaxSize = 32
|
||||||
|
|
||||||
// AllocationResult contains attributed of an allocated resource.
|
// AllocationResult contains attributes of an allocated resource.
|
||||||
type AllocationResult struct {
|
type AllocationResult struct {
|
||||||
// ResourceHandle contains arbitrary data returned by the driver after a
|
// ResourceHandles contain the state associated with an allocation that
|
||||||
// successful allocation. This is opaque for
|
// should be maintained throughout the lifetime of a claim. Each
|
||||||
// Kubernetes. Driver documentation may explain to users how to
|
// ResourceHandle contains data that should be passed to a specific kubelet
|
||||||
// interpret this data if needed.
|
// plugin once it lands on a node. This data is returned by the driver
|
||||||
|
// after a successful allocation and is opaque to Kubernetes. Driver
|
||||||
|
// documentation may explain to users how to interpret this data if needed.
|
||||||
//
|
//
|
||||||
// The maximum size of this field is 16KiB. This may get
|
// Setting this field is optional. It has a maximum size of 32 entries.
|
||||||
// increased in the future, but not reduced.
|
// If null (or empty), it is assumed this allocation will be processed by a
|
||||||
|
// single kubelet plugin with no ResourceHandle data attached. The name of
|
||||||
|
// the kubelet plugin invoked will match the DriverName set in the
|
||||||
|
// ResourceClaimStatus this AllocationResult is embedded in.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
// +optional
|
// +optional
|
||||||
ResourceHandle string
|
ResourceHandles []ResourceHandle
|
||||||
|
|
||||||
// This field will get set by the resource driver after it has
|
// This field will get set by the resource driver after it has allocated
|
||||||
// allocated the resource driver to inform the scheduler where it can
|
// the resource to inform the scheduler where it can schedule Pods using
|
||||||
// schedule Pods using the ResourceClaim.
|
// the ResourceClaim.
|
||||||
//
|
//
|
||||||
// Setting this field is optional. If null, the resource is available
|
// Setting this field is optional. If null, the resource is available
|
||||||
// everywhere.
|
// everywhere.
|
||||||
@ -155,8 +162,33 @@ type AllocationResult struct {
|
|||||||
Shareable bool
|
Shareable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceHandleMaxSize is the maximum size of allocation.resourceHandle.
|
// AllocationResultResourceHandlesMaxSize represents the maximum number of
|
||||||
const ResourceHandleMaxSize = 16 * 1024
|
// entries in allocation.resourceHandles.
|
||||||
|
const AllocationResultResourceHandlesMaxSize = 32
|
||||||
|
|
||||||
|
// ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.
|
||||||
|
type ResourceHandle struct {
|
||||||
|
// DriverName specifies the name of the resource driver whose kubelet
|
||||||
|
// plugin should be invoked to process this ResourceHandle's data once it
|
||||||
|
// lands on a node. This may differ from the DriverName set in
|
||||||
|
// ResourceClaimStatus this ResourceHandle is embedded in.
|
||||||
|
DriverName string
|
||||||
|
|
||||||
|
// Data contains the opaque data associated with this ResourceHandle. It is
|
||||||
|
// set by the controller component of the resource driver whose name
|
||||||
|
// matches the DriverName set in the ResourceClaimStatus this
|
||||||
|
// ResourceHandle is embedded in. It is set at allocation time and is
|
||||||
|
// intended for processing by the kubelet plugin whose name matches
|
||||||
|
// the DriverName set in this ResourceHandle.
|
||||||
|
//
|
||||||
|
// The maximum size of this field is 16KiB. This may get increased in the
|
||||||
|
// future, but not reduced.
|
||||||
|
// +optional
|
||||||
|
Data string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceHandleDataMaxSize represents the maximum size of resourceHandle.data.
|
||||||
|
const ResourceHandleDataMaxSize = 16 * 1024
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
@ -99,9 +99,9 @@ type ResourceClaimStatus struct {
|
|||||||
// +optional
|
// +optional
|
||||||
DriverName string `json:"driverName,omitempty" protobuf:"bytes,1,opt,name=driverName"`
|
DriverName string `json:"driverName,omitempty" protobuf:"bytes,1,opt,name=driverName"`
|
||||||
|
|
||||||
// Allocation is set by the resource driver once a resource has been
|
// Allocation is set by the resource driver once a resource or set of
|
||||||
// allocated successfully. If this is not specified, the resource is
|
// resources has been allocated successfully. If this is not specified, the
|
||||||
// not yet allocated.
|
// resources have not been allocated yet.
|
||||||
// +optional
|
// +optional
|
||||||
Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,2,opt,name=allocation"`
|
Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,2,opt,name=allocation"`
|
||||||
|
|
||||||
@ -133,21 +133,28 @@ type ResourceClaimStatus struct {
|
|||||||
// claim.status.reservedFor.
|
// claim.status.reservedFor.
|
||||||
const ResourceClaimReservedForMaxSize = 32
|
const ResourceClaimReservedForMaxSize = 32
|
||||||
|
|
||||||
// AllocationResult contains attributed of an allocated resource.
|
// AllocationResult contains attributes of an allocated resource.
|
||||||
type AllocationResult struct {
|
type AllocationResult struct {
|
||||||
// ResourceHandle contains arbitrary data returned by the driver after a
|
// ResourceHandles contain the state associated with an allocation that
|
||||||
// successful allocation. This is opaque for
|
// should be maintained throughout the lifetime of a claim. Each
|
||||||
// Kubernetes. Driver documentation may explain to users how to
|
// ResourceHandle contains data that should be passed to a specific kubelet
|
||||||
// interpret this data if needed.
|
// plugin once it lands on a node. This data is returned by the driver
|
||||||
|
// after a successful allocation and is opaque to Kubernetes. Driver
|
||||||
|
// documentation may explain to users how to interpret this data if needed.
|
||||||
//
|
//
|
||||||
// The maximum size of this field is 16KiB. This may get
|
// Setting this field is optional. It has a maximum size of 32 entries.
|
||||||
// increased in the future, but not reduced.
|
// If null (or empty), it is assumed this allocation will be processed by a
|
||||||
|
// single kubelet plugin with no ResourceHandle data attached. The name of
|
||||||
|
// the kubelet plugin invoked will match the DriverName set in the
|
||||||
|
// ResourceClaimStatus this AllocationResult is embedded in.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
// +optional
|
// +optional
|
||||||
ResourceHandle string `json:"resourceHandle,omitempty" protobuf:"bytes,1,opt,name=resourceHandle"`
|
ResourceHandles []ResourceHandle `json:"resourceHandles,omitempty" protobuf:"bytes,1,opt,name=resourceHandles"`
|
||||||
|
|
||||||
// This field will get set by the resource driver after it has
|
// This field will get set by the resource driver after it has allocated
|
||||||
// allocated the resource driver to inform the scheduler where it can
|
// the resource to inform the scheduler where it can schedule Pods using
|
||||||
// schedule Pods using the ResourceClaim.
|
// the ResourceClaim.
|
||||||
//
|
//
|
||||||
// Setting this field is optional. If null, the resource is available
|
// Setting this field is optional. If null, the resource is available
|
||||||
// everywhere.
|
// everywhere.
|
||||||
@ -160,8 +167,33 @@ type AllocationResult struct {
|
|||||||
Shareable bool `json:"shareable,omitempty" protobuf:"varint,3,opt,name=shareable"`
|
Shareable bool `json:"shareable,omitempty" protobuf:"varint,3,opt,name=shareable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceHandleMaxSize is the maximum size of allocation.resourceHandle.
|
// AllocationResultResourceHandlesMaxSize represents the maximum number of
|
||||||
const ResourceHandleMaxSize = 16 * 1024
|
// entries in allocation.resourceHandles.
|
||||||
|
const AllocationResultResourceHandlesMaxSize = 32
|
||||||
|
|
||||||
|
// ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.
|
||||||
|
type ResourceHandle struct {
|
||||||
|
// DriverName specifies the name of the resource driver whose kubelet
|
||||||
|
// plugin should be invoked to process this ResourceHandle's data once it
|
||||||
|
// lands on a node. This may differ from the DriverName set in
|
||||||
|
// ResourceClaimStatus this ResourceHandle is embedded in.
|
||||||
|
DriverName string `json:"driverName,omitempty" protobuf:"bytes,1,opt,name=driverName"`
|
||||||
|
|
||||||
|
// Data contains the opaque data associated with this ResourceHandle. It is
|
||||||
|
// set by the controller component of the resource driver whose name
|
||||||
|
// matches the DriverName set in the ResourceClaimStatus this
|
||||||
|
// ResourceHandle is embedded in. It is set at allocation time and is
|
||||||
|
// intended for processing by the kubelet plugin whose name matches
|
||||||
|
// the DriverName set in this ResourceHandle.
|
||||||
|
//
|
||||||
|
// The maximum size of this field is 16KiB. This may get increased in the
|
||||||
|
// future, but not reduced.
|
||||||
|
// +optional
|
||||||
|
Data string `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceHandleDataMaxSize represents the maximum size of resourceHandle.data.
|
||||||
|
const ResourceHandleDataMaxSize = 16 * 1024
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +k8s:prerelease-lifecycle-gen:introduced=1.26
|
// +k8s:prerelease-lifecycle-gen:introduced=1.26
|
||||||
|
Loading…
Reference in New Issue
Block a user