Chapter 12. ResourceSlice [resource.k8s.io/v1]
- Description
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 <driver name>, <pool name>, <device name>.
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.
- Type
-
object - Required
-
spec
-
12.1. Specification Copy linkLink copied to clipboard!
| Property | Type | Description |
|---|---|---|
|
|
| APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
|
|
| Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
|
| Standard object metadata | |
|
|
| ResourceSliceSpec contains the information published by the driver in one ResourceSlice. |
12.1.1. .spec Copy linkLink copied to clipboard!
- Description
- ResourceSliceSpec contains the information published by the driver in one ResourceSlice.
- Type
-
object - Required
-
driver -
pool
-
| Property | Type | Description |
|---|---|---|
|
|
| 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 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. |
|
|
| Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set. |
|
|
| 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. |
|
|
| 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 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 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. |
|
|
| ResourcePool describes the pool that ResourceSlices belong to. |
|
|
| 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. |
|
|
| 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. |
12.1.2. .spec.devices Copy linkLink copied to clipboard!
- Description
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.
- Type
-
array
12.1.3. .spec.devices[] Copy linkLink copied to clipboard!
- Description
- Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.
- Type
-
object - Required
-
name
-
| Property | Type | Description |
|---|---|---|
|
|
| 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 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 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. |
|
|
| 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 an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates. |
|
|
| 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 an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates. |
|
|
| 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 an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates. |
|
|
| 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. |
|
|
| DeviceCapacity describes a quantity associated with a device. |
|
|
| 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. |
|
|
| DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet. |
|
|
| Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label. |
|
|
| 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 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. | |
|
|
| 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 an alpha field and requires enabling the DRADeviceTaints feature gate. |
|
|
| 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. |
12.1.4. .spec.devices[].attributes Copy linkLink copied to clipboard!
- Description
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.
- Type
-
object
12.1.5. .spec.devices[].attributes{} Copy linkLink copied to clipboard!
- Description
- DeviceAttribute must have exactly one field set.
- Type
-
object
| Property | Type | Description |
|---|---|---|
|
|
| BoolValue is a true/false value. |
|
|
| IntValue is a number. |
|
|
| StringValue is a string. Must not be longer than 64 characters. |
|
|
| VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters. |
12.1.6. .spec.devices[].capacity Copy linkLink copied to clipboard!
- Description
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.
- Type
-
object
12.1.7. .spec.devices[].capacity{} Copy linkLink copied to clipboard!
- Description
- DeviceCapacity describes a quantity associated with a device.
- Type
-
object - Required
-
value
-
| Property | Type | Description |
|---|---|---|
|
|
| CapacityRequestPolicy defines how requests consume device capacity. Must not set more than one ValidRequestValues. |
|
| 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. |
12.1.8. .spec.devices[].capacity{}.requestPolicy Copy linkLink copied to clipboard!
- Description
CapacityRequestPolicy defines how requests consume device capacity.
Must not set more than one ValidRequestValues.
- Type
-
object
| Property | Type | Description |
|---|---|---|
|
| Default specifies how much of this capacity is consumed by a request that does not contain an entry for it in DeviceRequest’s Capacity. | |
|
|
| 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. |
|
| 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. |
12.1.9. .spec.devices[].capacity{}.requestPolicy.validRange Copy linkLink copied to clipboard!
- Description
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.
- Type
-
object - Required
-
min
-
| Property | Type | Description |
|---|---|---|
|
| 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. | |
|
| 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. | |
|
| 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. |
12.1.10. .spec.devices[].consumesCounters Copy linkLink copied to clipboard!
- Description
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.
- Type
-
array
12.1.11. .spec.devices[].consumesCounters[] Copy linkLink copied to clipboard!
- Description
- DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.
- Type
-
object - Required
-
counterSet -
counters
-
| Property | Type | Description |
|---|---|---|
|
|
| CounterSet is the name of the set from which the counters defined will be consumed. |
|
|
| Counters defines the counters that will be consumed by the device. The maximum number of counters is 32. |
|
|
| Counter describes a quantity associated with a device. |
12.1.12. .spec.devices[].consumesCounters[].counters Copy linkLink copied to clipboard!
- Description
Counters defines the counters that will be consumed by the device.
The maximum number of counters is 32.
- Type
-
object
12.1.13. .spec.devices[].consumesCounters[].counters{} Copy linkLink copied to clipboard!
- Description
- Counter describes a quantity associated with a device.
- Type
-
object - Required
-
value
-
| Property | Type | Description |
|---|---|---|
|
| Value defines how much of a certain device counter is available. |
12.1.14. .spec.devices[].taints Copy linkLink copied to clipboard!
- Description
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 an alpha field and requires enabling the DRADeviceTaints feature gate.
- Type
-
array
12.1.15. .spec.devices[].taints[] Copy linkLink copied to clipboard!
- Description
- 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.
- Type
-
object - Required
-
key -
effect
-
| Property | Type | Description |
|---|---|---|
|
|
| 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.
Possible enum values: - |
|
|
| The taint key to be applied to a device. Must be a label name. |
|
| TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set. | |
|
|
| The taint value corresponding to the taint key. Must be a label value. |
12.1.16. .spec.pool Copy linkLink copied to clipboard!
- Description
- ResourcePool describes the pool that ResourceSlices belong to.
- Type
-
object - Required
-
name -
generation -
resourceSliceCount
-
| Property | Type | Description |
|---|---|---|
|
|
| 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. |
|
|
| 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. |
|
|
| 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. |
12.2. API endpoints Copy linkLink copied to clipboard!
The following API endpoints are available:
/apis/resource.k8s.io/v1/resourceslices-
DELETE: delete collection of ResourceSlice -
GET: list or watch objects of kind ResourceSlice -
POST: create a ResourceSlice
-
/apis/resource.k8s.io/v1/watch/resourceslices-
GET: watch individual changes to a list of ResourceSlice. deprecated: use the 'watch' parameter with a list operation instead.
-
/apis/resource.k8s.io/v1/resourceslices/{name}-
DELETE: delete a ResourceSlice -
GET: read the specified ResourceSlice -
PATCH: partially update the specified ResourceSlice -
PUT: replace the specified ResourceSlice
-
/apis/resource.k8s.io/v1/watch/resourceslices/{name}-
GET: watch changes to an object of kind ResourceSlice. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.
-
12.2.1. /apis/resource.k8s.io/v1/resourceslices Copy linkLink copied to clipboard!
- HTTP method
-
DELETE - Description
- delete collection of ResourceSlice
| Parameter | Type | Description |
|---|---|---|
|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 401 - Unauthorized | Empty |
- HTTP method
-
GET - Description
- list or watch objects of kind ResourceSlice
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 401 - Unauthorized | Empty |
- HTTP method
-
POST - Description
- create a ResourceSlice
| Parameter | Type | Description |
|---|---|---|
|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
| Parameter | Type | Description |
|---|---|---|
|
|
|
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 201 - Created |
|
| 202 - Accepted |
|
| 401 - Unauthorized | Empty |
12.2.2. /apis/resource.k8s.io/v1/watch/resourceslices Copy linkLink copied to clipboard!
- HTTP method
-
GET - Description
- watch individual changes to a list of ResourceSlice. deprecated: use the 'watch' parameter with a list operation instead.
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 401 - Unauthorized | Empty |
12.2.3. /apis/resource.k8s.io/v1/resourceslices/{name} Copy linkLink copied to clipboard!
| Parameter | Type | Description |
|---|---|---|
|
|
| name of the ResourceSlice |
- HTTP method
-
DELETE - Description
- delete a ResourceSlice
| Parameter | Type | Description |
|---|---|---|
|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 202 - Accepted |
|
| 401 - Unauthorized | Empty |
- HTTP method
-
GET - Description
- read the specified ResourceSlice
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 401 - Unauthorized | Empty |
- HTTP method
-
PATCH - Description
- partially update the specified ResourceSlice
| Parameter | Type | Description |
|---|---|---|
|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 201 - Created |
|
| 401 - Unauthorized | Empty |
- HTTP method
-
PUT - Description
- replace the specified ResourceSlice
| Parameter | Type | Description |
|---|---|---|
|
|
| When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
|
|
| fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. |
| Parameter | Type | Description |
|---|---|---|
|
|
|
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 201 - Created |
|
| 401 - Unauthorized | Empty |
12.2.4. /apis/resource.k8s.io/v1/watch/resourceslices/{name} Copy linkLink copied to clipboard!
| Parameter | Type | Description |
|---|---|---|
|
|
| name of the ResourceSlice |
- HTTP method
-
GET - Description
- watch changes to an object of kind ResourceSlice. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.
| HTTP code | Reponse body |
|---|---|
| 200 - OK |
|
| 401 - Unauthorized | Empty |