You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The consumable capacity feature allows the same devices to be consumed by multiple independent ResourceClaims, with the Kubernetes scheduler
598
+
managing how much of the device's capacity is used up by each claim. This is analogous to how Pods can share
599
+
the resources on a Node; ResourceClaims can share the resources on a Device.
600
+
601
+
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.
602
+
603
+
Users can set `capacity` field added in `spec.devices.requests` of `ResourceClaim` to specify the device resource requirements for each allocation.
604
+
605
+
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**.
606
+
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.
607
+
608
+
Here is an example of a network device which allows multiple allocations and contains
609
+
a consumable bandwidth capacity.
610
+
611
+
```yaml
612
+
kind: ResourceSlice
613
+
apiVersion: resource.k8s.io/v1
614
+
metadata:
615
+
name: resourceslice
616
+
spec:
617
+
nodeName: worker-1
618
+
pool:
619
+
name: pool
620
+
generation: 1
621
+
resourceSliceCount: 1
622
+
driver: dra.example.com
623
+
devices:
624
+
- name: eth1
625
+
allowMultipleAllocations: true
626
+
attributes:
627
+
name:
628
+
string: "eth1"
629
+
capacity:
630
+
bandwidth:
631
+
requestPolicy:
632
+
default: "1M"
633
+
validRange:
634
+
min: "1M"
635
+
step: "8"
636
+
value: "10G"
637
+
```
638
+
639
+
The consumable capacity can be requested as shown in the below example.
640
+
641
+
```yaml
642
+
apiVersion: resource.k8s.io/v1
643
+
kind: ResourceClaimTemplate
644
+
metadata:
645
+
name: bandwidth-claim-template
646
+
spec:
647
+
spec:
648
+
devices:
649
+
requests:
650
+
- name: req-0
651
+
exactly:
652
+
- name:
653
+
deviceClassName: resource.example.com
654
+
capacity:
655
+
requests:
656
+
bandwidth: 1G
657
+
```
658
+
659
+
The allocation result will include the consumed capacity and the identifier of the share.
660
+
661
+
```yaml
662
+
apiVersion: resource.k8s.io/v1
663
+
kind: ResourceClaim
664
+
...
665
+
status:
666
+
allocation:
667
+
devices:
668
+
results:
669
+
- consumedCapacity:
670
+
bandwidth: 1G
671
+
device: eth1
672
+
shareID: "a671734a-e8e5-11e4-8fde-42010af09327"
673
+
```
674
+
675
+
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`.
676
+
593
677
### Device taints and tolerations {#device-taints-and-tolerations}
0 commit comments