diff --git a/content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md b/content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md index addd1b7bd87b4..f9af94c36ab70 100644 --- a/content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md +++ b/content/en/docs/concepts/scheduling-eviction/dynamic-resource-allocation.md @@ -529,6 +529,90 @@ Partitionable devices is an *alpha feature* and only enabled when the [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled in the kube-apiserver and kube-scheduler. +## Consumable capacity + +{{< feature-state feature_gate_name="DRAConsumableCapacity" >}} + +The consumable capacity feature allows the same devices to be consumed by multiple independent ResourceClaims, with the Kubernetes scheduler +managing how much of the device's capacity is used up by each claim. This is analogous to how Pods can share +the resources on a Node; ResourceClaims can share the resources on a Device. + +The device driver can set `allowMultipleAllocations` field added in `.spec.devices` of `ResourceSlice` to allow allocating that device to multiple independent ResourceClaims or to multiple requests within a ResourceClaim. + +Users can set `capacity` field added in `spec.devices.requests` of `ResourceClaim` to specify the device resource requirements for each allocation. + +For the device that allows multiple allocations, the requested capacity is drawn from — or consumed from — its total capacity, a concept known as **consumable capacity**. +Then, the scheduler ensures that the aggregate consumed capacity across all claims does not exceed the device’s overall capacity. Furthermore, driver authors can use the `requestPolicy` constraints on individual device capacities to control how those capacities are consumed. For example, the driver author can specify that a given capacity is only consumed in increments of 1Gi. + +Here is an example of a network device which allows multiple allocations and contains +a consumable bandwidth capacity. + +```yaml +kind: ResourceSlice +apiVersion: resource.k8s.io/v1 +metadata: + name: resourceslice +spec: + nodeName: worker-1 + pool: + name: pool + generation: 1 + resourceSliceCount: 1 + driver: dra.example.com + devices: + - name: eth1 + allowMultipleAllocations: true + attributes: + name: + string: "eth1" + capacity: + bandwidth: + requestPolicy: + default: "1M" + validRange: + min: "1M" + step: "8" + value: "10G" +``` + +The consumable capacity can be requested as shown in the below example. + +```yaml +apiVersion: resource.k8s.io/v1 +kind: ResourceClaimTemplate +metadata: + name: bandwidth-claim-template +spec: + spec: + devices: + requests: + - name: req-0 + exactly: + - name: + deviceClassName: resource.example.com + capacity: + requests: + bandwidth: 1G +``` + +The allocation result will include the consumed capacity and the identifier of the share. + +```yaml +apiVersion: resource.k8s.io/v1 +kind: ResourceClaim +... +status: + allocation: + devices: + results: + - consumedCapacity: + bandwidth: 1G + device: eth1 + shareID: "a671734a-e8e5-11e4-8fde-42010af09327" +``` + +In this example, a multiply-allocatable device was chosen. However, any `resource.example.com` device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatable device were chosen, the allocation would have resulted in the entire device. To force the use of a only multiply-allocatable devices, you can use the CEL criteria `device.allowMultipleAllocations == true`. + ### Device taints and tolerations {#device-taints-and-tolerations} {{< feature-state feature_gate_name="DRADeviceTaints" >}} diff --git a/content/en/docs/reference/command-line-tools-reference/feature-gates/DRAConsumableCapacity.md b/content/en/docs/reference/command-line-tools-reference/feature-gates/DRAConsumableCapacity.md new file mode 100644 index 0000000000000..29a441e42dbb6 --- /dev/null +++ b/content/en/docs/reference/command-line-tools-reference/feature-gates/DRAConsumableCapacity.md @@ -0,0 +1,15 @@ +--- +title: DRAConsumableCapacity +content_type: feature_gate +_build: + list: never + render: false + +stages: + - stage: alpha + defaultValue: false + fromVersion: "1.34" +--- +Enables device sharing across multiple ResourceClaims or requests. + +Additionally, if a device supports sharing, its resource (capacity) can be managed through a defined sharing policy.