ResourceSlice resource.k8s.io/v1beta2
ResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver. A pool may span more than one ResourceSlice, and exactly how many ResourceSlices comprise a pool is determined by the driver.
At the moment, the only supported resources are devices with attributes and capacities. Each device in a given pool, regardless of how many ResourceSlices, must have a unique name. The ResourceSlice in which a device gets published may change over time. The unique identifier for a device is the tuple
Whenever a driver needs to update a pool, it increments the pool.Spec.Pool.Generation number and updates all ResourceSlices with that new number and new resource definitions. A consumer must only use ResourceSlices with the highest generation number and ignore all others.
When allocating all resources in a pool matching certain criteria or when looking for the best solution among several different alternatives, a consumer should check the number of ResourceSlices in a pool (included in each ResourceSlice) to determine whether its view of a pool is complete and if not, should wait until the driver has completed updating the pool.
For resources that are not local to a node, the node name is not set. Instead, the driver may use a node selector to specify where the devices are available.
This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
Fields
- apiVersion:
resource.k8s.io/v1beta2 - kind:
ResourceSlice - metadata (ObjectMeta)
-
Standard object metadata
- spec (ResourceSliceSpec)
-
Contains the information published by the driver.
Changing the spec automatically increments the metadata.generation number.
ResourceSliceSpec
ResourceSliceSpec contains the information published by the driver in one ResourceSlice.
- driver (string)
-
Driver identifies the DRA driver providing the capacity information. A field selector can be used to list only ResourceSlice objects with a certain driver name.
Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. It should use only lower case characters. This field is immutable.
- pool (ResourcePool)
-
Pool describes the pool that this ResourceSlice belongs to.
ResourcePool describes the pool that ResourceSlices belong to.
- pool.generation (integer)
Generation tracks the change in a pool over time. Whenever a driver changes something about one or more of the resources in a pool, it must change the generation in all ResourceSlices which are part of that pool. Consumers of ResourceSlices should only consider resources from the pool with the highest generation number. The generation may be reset by drivers, which should be fine for consumers, assuming that all ResourceSlices in a pool are updated to match or deleted.
Combined with ResourceSliceCount, this mechanism enables consumers to detect pools which are comprised of multiple ResourceSlices and are in an incomplete state.
- pool.name (string)
Name is used to identify the pool. For node-local devices, this is often the node name, but this is not required.
It must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.
- pool.resourceSliceCount (integer)
ResourceSliceCount is the total number of ResourceSlices in the pool at this generation number. Must be greater than zero.
Consumers can use this to check whether they have seen all ResourceSlices belonging to the same pool.
- allNodes (boolean)
-
AllNodes indicates that all nodes have access to the resources in the pool.
Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
- devices ([]Device)
-
Devices lists some or all of the devices in this pool.
Must not have more than 128 entries. If any device uses taints or consumes counters the limit is 64.
Only one of Devices and SharedCounters can be set in a ResourceSlice.
- nodeName (string)
-
NodeName identifies the node which provides the resources in this pool. A field selector can be used to list only ResourceSlice objects belonging to a certain node.
This field can be used to limit access from nodes to ResourceSlices with the same node name. It also indicates to autoscalers that adding new nodes of the same type as some old node might also make new resources available.
Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set. This field is immutable.
- nodeSelector (NodeSelector)
-
NodeSelector defines which nodes have access to the resources in the pool, when that pool is not limited to a single node.
Must use exactly one term.
Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
- perDeviceNodeSelection (boolean)
-
PerDeviceNodeSelection defines whether the access from nodes to resources in the pool is set on the ResourceSlice level or on each device. If it is set to true, every device defined the ResourceSlice must specify this individually.
Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.
- sharedCounters ([]CounterSet)
-
SharedCounters defines a list of counter sets, each of which has a name and a list of counters available.
The names of the counter sets must be unique in the ResourcePool.
Only one of Devices and SharedCounters can be set in a ResourceSlice.
The maximum number of counter sets is 8.
Device
Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.
- name (string)
-
Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.
- allNodes (boolean)
-
AllNodes indicates that all nodes have access to the device.
Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
- allowMultipleAllocations (boolean)
-
AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.
If AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.
- attributes (map[string]DeviceAttribute)
-
Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.
The maximum number of attributes and capacities combined is 32.
DeviceAttribute must have exactly one field set.
- attributes.bool (boolean)
BoolValue is a true/false value.
- attributes.bools ([]boolean)
BoolValues is a non-empty list of true/false values.
- attributes.int (integer)
IntValue is a number.
- attributes.ints ([]integer)
IntValues is a non-empty list of numbers.
This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
- attributes.string (string)
StringValue is a string. Must not be longer than 64 characters.
- attributes.strings ([]string)
StringValues is a non-empty list of strings. Each string must not be longer than 64 characters.
This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
- attributes.version (string)
VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.
- attributes.versions ([]string)
VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. Each version string must not be longer than 64 characters.
This is an alpha field and requires enabling the DRAListTypeAttributes feature gate.
- bindingConditions ([]string)
-
BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.
The maximum number of binding conditions is 4.
The conditions must be a valid condition type string.
This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
- bindingFailureConditions ([]string)
-
BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to "True", a binding failure occurred.
The maximum number of binding failure conditions is 4.
The conditions must be a valid condition type string.
This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
- bindsToNode (boolean)
-
BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.
This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
- capacity (map[string]DeviceCapacity)
-
Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.
The maximum number of attributes and capacities combined is 32.
- consumesCounters ([]DeviceCounterConsumption)
-
ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.
There can only be a single entry per counterSet.
The maximum number of device counter consumptions per device is 2.
- nodeAllocatableResourceMappings (map[string]NodeAllocatableResourceMapping)
-
NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node
status.allocatablethat are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include "cpu", "memory", "ephemeral-storage", and hugepages. In addition to standard requests made through the Podspec, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). Extended resource names are not permitted as keys. - nodeName (string)
-
NodeName identifies the node where the device is available.
Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
- nodeSelector (NodeSelector)
-
NodeSelector defines the nodes where the device is available.
Must use exactly one term.
Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
- taints ([]DeviceTaint)
-
If specified, these are the driver-defined taints.
The maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.
This is a beta field and requires enabling the DRADeviceTaints feature gate.
DeviceCapacity
DeviceCapacity describes a quantity associated with a device.
- value (Quantity)
-
Value defines how much of a certain capacity that device has.
This field reflects the fixed total capacity and does not change. The consumed amount is tracked separately by scheduler and does not affect this value.
- requestPolicy (CapacityRequestPolicy)
-
RequestPolicy defines how this DeviceCapacity must be consumed when the device is allowed to be shared by multiple allocations.
The Device must have allowMultipleAllocations set to true in order to set a requestPolicy.
If unset, capacity requests are unconstrained: requests can consume any amount of capacity, as long as the total consumed across all allocations does not exceed the device's defined capacity. If request is also unset, default is the full capacity value.
CapacityRequestPolicy
CapacityRequestPolicy defines how requests consume device capacity.
Must not set more than one ValidRequestValues.
- default (Quantity)
-
Default specifies how much of this capacity is consumed by a request that does not contain an entry for it in DeviceRequest's Capacity.
- validRange (CapacityRequestPolicyRange)
-
ValidRange defines an acceptable quantity value range in consuming requests.
If this field is set, Default must be defined and it must fall within the defined ValidRange.
If the requested amount does not fall within the defined range, the request violates the policy, and this device cannot be allocated.
If the request doesn't contain this capacity entry, Default value is used.
- validValues ([]Quantity)
-
ValidValues defines a set of acceptable quantity values in consuming requests.
Must not contain more than 10 entries. Must be sorted in ascending order.
If this field is set, Default must be defined and it must be included in ValidValues list.
If the requested amount does not match any valid value but smaller than some valid values, the scheduler calculates the smallest valid value that is greater than or equal to the request. That is: min(ceil(requestedValue) ∈ validValues), where requestedValue ≤ max(validValues).
If the requested amount exceeds all valid values, the request violates the policy, and this device cannot be allocated.
CapacityRequestPolicyRange
CapacityRequestPolicyRange defines a valid range for consumable capacity values.
- If the requested amount is less than Min, it is rounded up to the Min value.
- If Step is set and the requested amount is between Min and Max but not aligned with Step, it will be rounded up to the next value equal to Min + (n * Step).
- If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set).
- If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy, and the device cannot be allocated.
- min (Quantity)
-
Min specifies the minimum capacity allowed for a consumption request.
Min must be greater than or equal to zero, and less than or equal to the capacity value. requestPolicy.default must be more than or equal to the minimum.
- max (Quantity)
-
Max defines the upper limit for capacity that can be requested.
Max must be less than or equal to the capacity value. Min and requestPolicy.default must be less than or equal to the maximum.
- step (Quantity)
-
Step defines the step size between valid capacity amounts within the range.
Max (if set) and requestPolicy.default must be a multiple of Step. Min + Step must be less than or equal to the capacity value.
DeviceCounterConsumption
DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.
- counterSet (string)
-
CounterSet is the name of the set from which the counters defined will be consumed.
- counters (map[string]Counter)
-
Counters defines the counters that will be consumed by the device.
The maximum number of counters is 32.
Counter
Counter describes a quantity associated with a device.
- value (Quantity)
-
Value defines how much of a certain device counter is available.
NodeAllocatableResourceMapping
NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.
- allocationMultiplier (Quantity)
-
AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether
capacityKeyis set. 1. IfcapacityKeyis NOT set:allocationMultipliermultiplies the device count allocated to the claim. a. A DRA driver representing each CPU core as a device would have {ResourceName: "cpu", allocationMultiplier: "2"} in itsnodeAllocatableResourceMappings. If 4 devices are allocated to the claim, 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. b. A GPU device that needs additional node memory per GPU allocation would have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated GPU device instance of this type will account for 2Gi of memory.- If
capacityKeyIS set:allocationMultiplieris multiplied by the amount of that capacity consumed. The final node allocatable resource amount isconsumedCapacity[capacityKey]*allocationMultiplier. For example, if a Device's capacity "dra.example.com/cores" is consumed, and each "core" provides 2 "cpu"s, the mapping would be: {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16.
- If
- capacityKey (string)
-
CapacityKey references a capacity name defined as a key in the
spec.devices[*].capacitymap. When this field is set, the value associated with this key in thestatus.allocation.devices.results[*].consumedCapacitymap (for a specific claim allocation) determines the base quantity for the node allocatable resource. IfallocationMultiplieris also set, it is multiplied with the base quantity. For example, ifspec.devices[*].capacityhas an entry "dra.example.com/memory": "128Gi", and this field is set to "dra.example.com/memory", then for a claim allocation that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the node allocatable resource mapping will be "4Gi", andallocationMultipliershould be omitted or set to "1".
DeviceTaint
The device this taint is attached to has the "effect" on any claim which does not tolerate the taint and, through the claim, to pods using the claim.
- effect (string)
-
The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them.
Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here. More effects may get added in the future. Consumers must treat unknown effects like None.
- key (string)
-
The taint key to be applied to a device. Must be a label name.
- timeAdded (Time)
-
TimeAdded represents the time at which the taint was added or (only in a DeviceTaintRule) the effect was modified. Added automatically during create or update if not set.
In addition, in a DeviceTaintRule a value provided during an update gets replaced with the current time if the provided value is the same as the old one and the new effect is different. Changing the key and/or value while keeping the effect unchanged is possible and does not update the time stamp because the eviction which uses it is either already started (NoExecute) or not started yet (NoEffect, NoSchedule).
- value (string)
-
The taint value corresponding to the taint key. Must be a label value.
CounterSet
CounterSet defines a named set of counters that are available to be used by devices defined in the ResourcePool.
The counters are not allocatable by themselves, but can be referenced by devices. When a device is allocated, the portion of counters it uses will no longer be available for use by other devices.
- counters (map[string]Counter)
-
Counters defines the set of counters for this CounterSet The name of each counter must be unique in that set and must be a DNS label.
The maximum number of counters is 32.
- name (string)
-
Name defines the name of the counter set. It must be a DNS label.
ResourceSliceList
ResourceSliceList is a collection of ResourceSlices.
- apiVersion:
resource.k8s.io/v1beta2 - kind:
ResourceSliceList - metadata (ListMeta)
-
Standard list metadata
- items ([]ResourceSlice)
-
Items is the list of resource ResourceSlices.