@@ -185,6 +185,58 @@ the Pod that triggered the generation.
185
185
To learn how to claim resources using one of these methods, see
186
186
[ Allocate Devices to Workloads with DRA] ( /docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/ ) .
187
187
188
+ #### Prioritized list {#prioritized-list}
189
+
190
+ {{< feature-state feature_gate_name="DRAPrioritizedList" >}}
191
+
192
+ You can provide a prioritized list of subrequests for requests in a ResourceClaim or
193
+ ResourceClaimTemplate. The scheduler will then select the first subrequest that can be allocated.
194
+ This allows users to specify alternative devices that can be used by the workload if the primary
195
+ choice is not available.
196
+
197
+ In the example below, the ResourceClaimTemplate requested a device with the color black
198
+ and the size large. If a device with those attributes is not available, the pod cannot
199
+ be scheduled. With the priotized list feature, a second alternative can be specified, which
200
+ requests two devices with the color white and size small. The large black device will be
201
+ allocated if it is available. If it is not, but two small white devices are available,
202
+ the pod will still be able to run.
203
+
204
+ ``` yaml
205
+ apiVersion : resource.k8s.io/v1
206
+ kind : ResourceClaimTemplate
207
+ metadata :
208
+ name : prioritized-list-claim-template
209
+ spec :
210
+ spec :
211
+ devices :
212
+ requests :
213
+ - name : req-0
214
+ firstAvailable :
215
+ - name : large-black
216
+ deviceClassName : resource.example.com
217
+ selectors :
218
+ - cel :
219
+ expression : |-
220
+ device.attributes["resource-driver.example.com"].color == "black" &&
221
+ device.attributes["resource-driver.example.com"].size == "large"
222
+ - name : small-white
223
+ deviceClassName : resource.example.com
224
+ selectors :
225
+ - cel :
226
+ expression : |-
227
+ device.attributes["resource-driver.example.com"].color == "white" &&
228
+ device.attributes["resource-driver.example.com"].size == "small"
229
+ count : 2
230
+ ` ` `
231
+
232
+ The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or
233
+ similar grouping, you cannot rely on all the members of the group having the same subrequest
234
+ chosen. Your workload must be able to accommodate this.
235
+
236
+ Prioritized lists is a *beta feature* and is enabled by default with the
237
+ ` DRAPrioritizedList` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) in
238
+ the kube-apiserver and kube-scheduler.
239
+
188
240
# ## ResourceSlice {#resourceslice}
189
241
190
242
Each ResourceSlice represents one or more
@@ -484,54 +536,6 @@ Extended resource allocation by DRA is an *alpha feature* and only enabled when
484
536
` DRAExtendedResource` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
485
537
is enabled in the kube-apiserver, kube-scheduler, and kubelet.
486
538
487
- # ## Prioritized list {#prioritized-list}
488
-
489
- {{< feature-state feature_gate_name="DRAPrioritizedList" >}}
490
-
491
- You can provide a prioritized list of subrequests for requests in a ResourceClaim. The
492
- scheduler will then select the first subrequest that can be allocated. This allows users to
493
- specify alternative devices that can be used by the workload if the primary choice is not
494
- available.
495
-
496
- In the example below, the ResourceClaimTemplate requested a device with the color black
497
- and the size large. If a device with those attributes are not available, the pod can not
498
- be scheduled. With the priotized list feature, a second alternative can be specified, which
499
- requests two devices with the color white and size small. The large black device will be
500
- allocated if it is available. But if it is not and two small white devices are available,
501
- the pod will still be able to run.
502
-
503
- ` ` ` yaml
504
- apiVersion: resource.k8s.io/v1
505
- kind: ResourceClaimTemplate
506
- metadata:
507
- name: prioritized-list-claim-template
508
- spec:
509
- spec:
510
- devices:
511
- requests:
512
- - name: req-0
513
- firstAvailable:
514
- - name: large-black
515
- deviceClassName: resource.example.com
516
- selectors:
517
- - cel:
518
- expression: |-
519
- device.attributes["resource-driver.example.com"].color == "black" &&
520
- device.attributes["resource-driver.example.com"].size == "large"
521
- - name: small-white
522
- deviceClassName: resource.example.com
523
- selectors:
524
- - cel:
525
- expression: |-
526
- device.attributes["resource-driver.example.com"].color == "white" &&
527
- device.attributes["resource-driver.example.com"].size == "small"
528
- count: 2
529
- ` ` `
530
-
531
- Prioritized lists is an *alpha feature* and only enabled when the
532
- ` DRAPrioritizedList` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
533
- is enabled in the kube-apiserver and kube-scheduler.
534
-
535
539
# ## Partitionable devices {#partitionable-devices}
536
540
537
541
{{< feature-state feature_gate_name="DRAPartitionableDevices" >}}
0 commit comments