ResourceClaimSpec
io.k8s.api.resource.v1beta1.ResourceClaimSpec
source ↗
ResourceClaimSpec defines what is being requested in a ResourceClaim and how to configure it.
devicesDeviceClaimDevices defines how to request devices.
config[]DeviceClaimConfigurationThis field holds configuration for multiple potential drivers which could satisfy requests in this claim. It is ignored while allocating the claim.
opaqueOpaqueDeviceConfigurationOpaque provides driver-specific configuration parameters.
driverstring requiredDriver is used to determine which kubelet plugin needs to be passed these configuration parameters.An admission policy provided by the driver developer could use this to decide whether it needs to validate them.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.parametersRawExtension requiredParameters can contain arbitrary data. It is the responsibility of the driver developer to handle validation and versioning. Typically this includes self-identification and a version ("kind" + "apiVersion" for Kubernetes types), with conversion between different versions.The length of the raw data must be smaller or equal to 10 Ki.requests[]stringRequests lists the names of requests where the configuration applies. If empty, it applies to all requests.References to subrequests must include the name of the main request and may include the subrequest using the format <main request>[/<subrequest>]. If just the main request is given, the configuration applies to all subrequests.constraints[]DeviceConstraintThese constraints must be satisfied by the set of devices that get allocated for the claim.
distinctAttributestringDistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.This acts as the inverse of MatchAttribute.This constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.This is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.matchAttributestringMatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.For example, if you specified "dra.example.com/numa" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.Must include the domain qualifier.requests[]stringRequests is a list of the one or more requests in this claim which must co-satisfy this constraint. If a request is fulfilled by multiple devices, then all of the devices must satisfy the constraint. If this is not specified, this constraint applies to all requests in this claim.References to subrequests must include the name of the main request and may include the subrequest using the format <main request>[/<subrequest>]. If just the main request is given, the constraint applies to all subrequests.requests[]DeviceRequestRequests represent individual requests for distinct devices which must all be satisfied. If empty, nothing needs to be allocated.
adminAccessbooleanAdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.This field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.This is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.allocationModestringAllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:- ExactCount: This request is for a specific number of devices.
- All: This request is for all of the matching devices in a pool.
capacityCapacityRequirementsCapacity define resource requirements against each capacity.If this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.Applies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.
requestsmap[string]QuantityRequests represent individual device resource requests for distinct resources, all of which must be provided by the device.This value is used as an additional filtering condition against the available capacity on the device. This is semantically equivalent to a CEL selector with `device.capacity[<domain>].<name>.compareTo(quantity(<request quantity>)) >= 0`. For example, device.capacity['test-driver.cdi.k8s.io'].counters.compareTo(quantity('2')) >= 0.When a requestPolicy is defined, the requested amount is adjusted upward to the nearest valid value based on the policy. If the requested amount cannot be adjusted to a valid value—because it exceeds what the requestPolicy allows— the device is considered ineligible for allocation.For any capacity that is not explicitly requested: - If no requestPolicy is set, the default consumed capacity is equal to the full device capacity (i.e., the whole device is claimed).- If a requestPolicy is set, the default consumed capacity is determined according to that policy.
countinteger (int64)Count is used only when the count mode is "ExactCount". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.This field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.deviceClassNamestringDeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this request.A class is required if no subrequests are specified in the firstAvailable list and no class can be set if subrequests are specified in the firstAvailable list. Which classes are available depends on the cluster.Administrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.firstAvailable[]DeviceSubRequestFirstAvailable contains subrequests, of which exactly one will be satisfied by the scheduler to satisfy this request. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one cannot be used.This field may only be set in the entries of DeviceClaim.Requests.DRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.
allocationModestringAllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:- ExactCount: This request is for a specific number of devices.
- All: This subrequest is for all of the matching devices in a pool.
capacityCapacityRequirementsCapacity define resource requirements against each capacity.If this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.Applies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.
requestsmap[string]QuantityRequests represent individual device resource requests for distinct resources, all of which must be provided by the device.This value is used as an additional filtering condition against the available capacity on the device. This is semantically equivalent to a CEL selector with `device.capacity[<domain>].<name>.compareTo(quantity(<request quantity>)) >= 0`. For example, device.capacity['test-driver.cdi.k8s.io'].counters.compareTo(quantity('2')) >= 0.When a requestPolicy is defined, the requested amount is adjusted upward to the nearest valid value based on the policy. If the requested amount cannot be adjusted to a valid value—because it exceeds what the requestPolicy allows— the device is considered ineligible for allocation.For any capacity that is not explicitly requested: - If no requestPolicy is set, the default consumed capacity is equal to the full device capacity (i.e., the whole device is claimed).- If a requestPolicy is set, the default consumed capacity is determined according to that policy.
countinteger (int64)Count is used only when the count mode is "ExactCount". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.deviceClassNamestring requiredDeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.A class is required. Which classes are available depends on the cluster.Administrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.namestring requiredName can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format <main request>/<subrequest>.Must be a DNS label.selectors[]DeviceSelectorSelectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.
celCELDeviceSelectorCEL contains a CEL expression for selecting a device.
expressionstring requiredExpression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.The expression's input is an object named "device", which carries the following properties:- driver (string): the name of the driver which defines this device.
- attributes (map[string]object): the device's attributes, grouped by prefix
- capacity (map[string]object): the device's capacities, grouped by prefix.
- allowMultipleAllocations (bool): the allowMultipleAllocations property of the device
tolerations[]DeviceTolerationIf specified, the request's tolerations.Tolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.In addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.The maximum number of tolerations is 16.This is an alpha field and requires enabling the DRADeviceTaints feature gate.
effectstringEffect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule and NoExecute.keystringKey is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.operatorstringOperator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a ResourceClaim can tolerate all taints of a particular category.tolerationSecondsinteger (int64)TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. If larger than zero, the time when the pod needs to be evicted is calculated as <time when taint was adedd> + <toleration seconds>.valuestringValue is the taint value the toleration matches to. If the operator is Exists, the value must be empty, otherwise just a regular string. Must be a label value.namestring requiredName can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim.Must be a DNS label and unique among all DeviceRequests in a ResourceClaim.selectors[]DeviceSelectorSelectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.This field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.
celCELDeviceSelectorCEL contains a CEL expression for selecting a device.
expressionstring requiredExpression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.The expression's input is an object named "device", which carries the following properties:- driver (string): the name of the driver which defines this device.
- attributes (map[string]object): the device's attributes, grouped by prefix
- capacity (map[string]object): the device's capacities, grouped by prefix.
- allowMultipleAllocations (bool): the allowMultipleAllocations property of the device
tolerations[]DeviceTolerationIf specified, the request's tolerations.Tolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.In addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.The maximum number of tolerations is 16.This field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.This is an alpha field and requires enabling the DRADeviceTaints feature gate.
effectstringEffect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule and NoExecute.keystringKey is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.operatorstringOperator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a ResourceClaim can tolerate all taints of a particular category.tolerationSecondsinteger (int64)TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. If larger than zero, the time when the pod needs to be evicted is calculated as <time when taint was adedd> + <toleration seconds>.valuestringValue is the taint value the toleration matches to. If the operator is Exists, the value must be empty, otherwise just a regular string. Must be a label value.