@@ -322,6 +322,15 @@ type Device struct {
322
322
// +listType=atomic
323
323
// +featureGate=DRADeviceTaints
324
324
Taints []DeviceTaint
325
+
326
+ // Shared marks whether the device is shared.
327
+ //
328
+ // The device with shared="true" can be allocated to more than one resource claim,
329
+ //
330
+ // +optional
331
+ // +default=false
332
+ // +featureGate=DRAConsumableCapacity
333
+ Shared * bool
325
334
}
326
335
327
336
// DeviceCounterConsumption defines a set of counters that
@@ -351,8 +360,60 @@ type DeviceCapacity struct {
351
360
// +required
352
361
Value resource.Quantity
353
362
354
- // potential future addition: fields which define how to "consume"
355
- // capacity (= share a single device between different consumers).
363
+ // ClaimPolicy specifies that this device capacity must be consumed
364
+ // by each resource claim according to the defined consumption policy.
365
+ //
366
+ // +optional
367
+ // +featureGate=DRAConsumableCapacity
368
+ ClaimPolicy * CapacityClaimPolicy
369
+ }
370
+
371
+ // CapacityClaimPolicy defines consumption policy for consumable capacity.
372
+ // Either one of the consumption policies must be defined.
373
+ type CapacityClaimPolicy struct {
374
+ // Set defines a set of acceptable quantities of consuming requests.
375
+ //
376
+ // +optional
377
+ // +oneOf=CapacityClaimPolicy
378
+ Set * CapacityClaimPolicySet
379
+
380
+ // Range defines an acceptable quantity range of consuming requests.
381
+ // +optional
382
+ // +oneOf=CapacityClaimPolicy
383
+ Range * CapacityClaimPolicyRange
384
+ }
385
+
386
+ // CapacityClaimPolicySet defines a discrete set of allowable capacity values for consumption.
387
+ type CapacityClaimPolicySet struct {
388
+ // Default specifies the default capacity to be used for a consumption request
389
+ // if no value is explicitly provided.
390
+ //
391
+ // +required
392
+ Default resource.Quantity
393
+
394
+ // Options defines a discrete set of additional valid capacity values that can be requested.
395
+ // +optional
396
+ // +listType=atomic
397
+ Options []resource.Quantity
398
+ }
399
+
400
+ // CapacityClaimPolicyRange defines a valid range of consuming capacity.
401
+ type CapacityClaimPolicyRange struct {
402
+ // Minimum specifies the minimum capacity required for a consumption request.
403
+ // This field is required and serves as the default capacity to be consumed.
404
+ //
405
+ // +required
406
+ Minimum resource.Quantity
407
+
408
+ // Maximum specifies the maximum capacity that can be requested in a consumption request.
409
+ //
410
+ // +optional
411
+ Maximum * resource.Quantity
412
+
413
+ // Step defines the incremental block size by which capacity can increase from the minimum.
414
+ //
415
+ // +optional
416
+ Step * resource.Quantity
356
417
}
357
418
358
419
// Counter describes a quantity associated with a device.
@@ -640,6 +701,18 @@ type DeviceRequest struct {
640
701
FirstAvailable []DeviceSubRequest
641
702
}
642
703
704
+ // CapacityRequirements defines the capacity requirements for a specific device request.
705
+ type CapacityRequirements struct {
706
+ // Requests specifies the requested quantity of device capacities for a device request,
707
+ // keyed by qualified resource names.
708
+ // +optional
709
+ Requests map [QualifiedName ]resource.Quantity
710
+
711
+ // Potentially enhancement field.
712
+ // Limits define the maximum amount of per-device resources allowed.
713
+ // This enables burstable usage when applicable.
714
+ }
715
+
643
716
// ExactDeviceRequest is a request for one or more identical devices.
644
717
type ExactDeviceRequest struct {
645
718
// DeviceClassName references a specific DeviceClass, which can define
@@ -731,6 +804,12 @@ type ExactDeviceRequest struct {
731
804
// +listType=atomic
732
805
// +featureGate=DRADeviceTaints
733
806
Tolerations []DeviceToleration
807
+
808
+ // Capacities defines resource requirements against each capacity.
809
+ //
810
+ // +optional
811
+ // +featureGate=DRAConsumableCapacity
812
+ Capacities * CapacityRequirements
734
813
}
735
814
736
815
// DeviceSubRequest describes a request for device provided in the
@@ -825,6 +904,12 @@ type DeviceSubRequest struct {
825
904
// +listType=atomic
826
905
// +featureGate=DRADeviceTaints
827
906
Tolerations []DeviceToleration
907
+
908
+ // Capacities defines requirements against capacity.
909
+ //
910
+ // +optional
911
+ // +featureGate=DRAConsumableCapacity
912
+ Capacities * CapacityRequirements
828
913
}
829
914
830
915
const (
@@ -968,6 +1053,15 @@ type DeviceConstraint struct {
968
1053
// +oneOf=ConstraintType
969
1054
MatchAttribute * FullyQualifiedName
970
1055
1056
+ // DistinctAttribute requires that all devices in question have this
1057
+ // attribute and that its type and value are unique across those devices.
1058
+ //
1059
+ // For example, specify attribute name to get virtual devices from distinct shared physical devices.
1060
+ //
1061
+ // +optional
1062
+ // +oneOf=ConstraintType
1063
+ DistinctAttribute * FullyQualifiedName
1064
+
971
1065
// Potential future extension, not part of the current design:
972
1066
// A CEL expression which compares different devices and returns
973
1067
// true if they match.
@@ -1272,6 +1366,19 @@ type DeviceRequestAllocationResult struct {
1272
1366
// +listType=atomic
1273
1367
// +featureGate=DRADeviceTaints
1274
1368
Tolerations []DeviceToleration
1369
+
1370
+ // Shared indicates whether the allocated device can be shared by multiple claims.
1371
+ //
1372
+ // +optional
1373
+ // +featureGate=DRAConsumableCapacity
1374
+ Shared * bool
1375
+
1376
+ // ConsumedCapacities is used for tracking the capacity consumed per device by the claim request.
1377
+ // The total consumed capacity for each device must not exceed its corresponding available capacity.
1378
+ //
1379
+ // +optional
1380
+ // +featureGate=DRAConsumableCapacity
1381
+ ConsumedCapacities map [QualifiedName ]resource.Quantity
1275
1382
}
1276
1383
1277
1384
// DeviceAllocationConfiguration gets embedded in an AllocationResult.
0 commit comments