@@ -1190,10 +1190,6 @@ of the cluster in an allocated state.
1190
1190
1191
1191
``` go
1192
1192
type ResourceClaimSpec struct {
1193
- // These constraints must be satisfied by the set of devices that get
1194
- // allocated for the claim.
1195
- Constraints []Constraint
1196
-
1197
1193
// Requests are individual requests for separate resources for the claim.
1198
1194
// An empty list is valid and means that the claim can always be allocated
1199
1195
// without needing anything. A class can be referenced to use the default
@@ -1202,9 +1198,13 @@ type ResourceClaimSpec struct {
1202
1198
// +listType=atomic
1203
1199
Requests []Request
1204
1200
1201
+ // These constraints must be satisfied by the set of devices that get
1202
+ // allocated for the claim.
1203
+ Constraints []Constraint
1204
+
1205
1205
// This field holds configuration for multiple potential drivers which
1206
- // could satisfy requests in this claim. The configuration applies to
1207
- // the entire claim. It is ignored while allocating the claim.
1206
+ // could satisfy requests in this claim. It is ignored while allocating
1207
+ // the claim.
1208
1208
//
1209
1209
// +optional
1210
1210
// +listType=atomic
@@ -1217,36 +1217,6 @@ type ResourceClaimSpec struct {
1217
1217
// Score *SomeScoringStruct
1218
1218
}
1219
1219
1220
- // Besides the request name slice, constraint must have one and only one field set.
1221
- type Constraint struct {
1222
- // The constraint applies to devices in these requests. A single entry is okay
1223
- // and used when that request is for multiple devices.
1224
- //
1225
- // If empty, the constrain applies to all devices in the claim.
1226
- //
1227
- // +optional
1228
- RequestNames []string
1229
-
1230
- // The devices must have this attribute and its value must be the same.
1231
- //
1232
- // For example, if you specified "numa.dra.example.com" (a hypothetical example!),
1233
- // then only devices in the same NUMA node will be chosen.
1234
- //
1235
- // +optional
1236
- // +listType=atomic
1237
- MatchAttribute *string
1238
-
1239
- // Future extension, not part of the current design:
1240
- // A CEL expression which compares different devices and returns
1241
- // true if they match.
1242
- //
1243
- // Because it would be part of a one-of, old schedulers will not
1244
- // accidentally ignore this additional, for them unknown match
1245
- // criteria.
1246
- //
1247
- // matcher string
1248
- }
1249
-
1250
1220
// Request is a request for one of many resources required for a claim.
1251
1221
// This is typically a request for a single resource like a device, but can
1252
1222
// also ask for several identical devices. It might get extended to support
@@ -1258,7 +1228,7 @@ type Request struct {
1258
1228
// Must be a DNS label.
1259
1229
Name string
1260
1230
1261
- *ResourceRequestDetail
1231
+ *RequestDetail
1262
1232
1263
1233
// FUTURE EXTENSION:
1264
1234
//
@@ -1267,10 +1237,10 @@ type Request struct {
1267
1237
//
1268
1238
// +optional
1269
1239
// +listType=atomic
1270
- // OneOf []ResourceRequestDetail
1240
+ // OneOf []RequestDetail
1271
1241
}
1272
1242
1273
- type ResourceRequestDetail struct {
1243
+ type RequestDetail struct {
1274
1244
// When referencing a DeviceClass, a request inherits additional
1275
1245
// configuration and selectors.
1276
1246
//
@@ -1285,13 +1255,6 @@ type ResourceRequestDetail struct {
1285
1255
1286
1256
*Amount // inline, so no extra level in YAML and no separate documentation
1287
1257
1288
- // Config defines configuration parameters that apply to the requested resource(s).
1289
- // They are ignored while allocating the claim.
1290
- //
1291
- // +optional
1292
- // +listType=atomic
1293
- Config []ConfigurationParameters
1294
-
1295
1258
// AdminAccess indicates that this is a claim for administrative access
1296
1259
// to the device(s). Claims with AdminAccess are expected to be used for
1297
1260
// monitoring or other management services for a device. They ignore
@@ -1340,6 +1303,21 @@ type Selector struct {
1340
1303
// +optional
1341
1304
Expression *string
1342
1305
}
1306
+ ```
1307
+
1308
+ ```
1309
+ <<[UNRESOLVED @pohly ]>>
1310
+
1311
+ The `device.` prefix is included in the CEL environment for the reasons given in
1312
+ https://github.com/kubernetes-sigs/wg-device-management/issues/23#issuecomment-2160044359.
1313
+
1314
+ Whether we really do it like that will be discussed further in that issue and/or during
1315
+ the implementation phase. Dropping it is not a conceptual change.
1316
+
1317
+ <<[/UNRESOLVED]>>
1318
+ ```
1319
+
1320
+ ``` go
1343
1321
1344
1322
// Exactly one field must be set.
1345
1323
type Amount struct {
@@ -1361,8 +1339,45 @@ type Amount struct {
1361
1339
Count *int64
1362
1340
}
1363
1341
1364
- // ConfigurationParameters must have one and only one field set.
1342
+ // Besides the request name slice, constraint must have one and only one field set.
1343
+ type Constraint struct {
1344
+ // The constraint applies to devices in these requests. A single entry is okay
1345
+ // and used when that request is for multiple devices.
1346
+ //
1347
+ // If empty, the constrain applies to all devices in the claim.
1348
+ //
1349
+ // +optional
1350
+ RequestNames []string
1351
+
1352
+ // The devices must have this attribute and its value must be the same.
1353
+ //
1354
+ // For example, if you specified "numa.dra.example.com" (a hypothetical example!),
1355
+ // then only devices in the same NUMA node will be chosen.
1356
+ //
1357
+ // +optional
1358
+ // +listType=atomic
1359
+ MatchAttribute *string
1360
+
1361
+ // Future extension, not part of the current design:
1362
+ // A CEL expression which compares different devices and returns
1363
+ // true if they match.
1364
+ //
1365
+ // Because it would be part of a one-of, old schedulers will not
1366
+ // accidentally ignore this additional, for them unknown match
1367
+ // criteria.
1368
+ //
1369
+ // matcher string
1370
+ }
1371
+
1372
+ // Besides the request name slice, ConfigurationParameters must have one and only one field set.
1365
1373
type ConfigurationParameters struct {
1374
+ // The constraint applies to devices in these requests.
1375
+ //
1376
+ // If empty, the configuration applies to all devices in the claim.
1377
+ //
1378
+ // +optional
1379
+ RequestNames []string
1380
+
1366
1381
Opaque *OpaqueConfigurationParameters
1367
1382
}
1368
1383
@@ -1471,18 +1486,22 @@ type DeviceClass struct {
1471
1486
``` go
1472
1487
// AllocationResult contains attributes of an allocated resource.
1473
1488
type AllocationResult struct {
1474
- // This field holds configuration for all drivers which
1475
- // satisfied requests in this claim. The configuration applies to
1476
- // the entire claim.
1489
+ // Results lists all allocated devices.
1477
1490
//
1478
- // +optional
1479
1491
// +listType=atomic
1480
- Config []ConfigurationParameters
1492
+ Results []RequestAllocationResult
1481
1493
1482
- // Results lists all allocated devices.
1494
+ // This field is a combination of all the claim and class configuration parameters.
1495
+ // Drivers can distinguish between those based on a flag.
1496
+ //
1497
+ // This includes configuration parameters for drivers which have no allocated
1498
+ // devices in the result because it is up to the drivers which configuration
1499
+ // parameters they support. They can silently ignore unknown configuration
1500
+ // parameters.
1483
1501
//
1502
+ // +optional
1484
1503
// +listType=atomic
1485
- Results []RequestAllocationResult
1504
+ Config []AllocationConfigurationParameters
1486
1505
1487
1506
// Setting this field is optional. If unset, the allocated devices are available everywhere.
1488
1507
//
@@ -1494,8 +1513,7 @@ type AllocationResult struct {
1494
1513
// entries in allocation.results.
1495
1514
const AllocationResultsMaxSize = 32
1496
1515
1497
- // RequestAllocationResult contains configuration and the allocation result for
1498
- // one request.
1516
+ // RequestAllocationResult contains the allocation result for one request.
1499
1517
type RequestAllocationResult struct {
1500
1518
// DriverName specifies the name of the DRA driver whose kubelet
1501
1519
// plugin should be invoked to process the allocation once the claim is
@@ -1505,17 +1523,6 @@ type RequestAllocationResult struct {
1505
1523
// vendor of the driver.
1506
1524
DriverName string
1507
1525
1508
- // Config contains all the configuration parameters that apply to the request
1509
- // and that were meant for the driver which handles these devices.
1510
- // They get collected during the allocation and stored here
1511
- // to ensure that they remain available while the claim is allocated.
1512
- //
1513
- // Entries are list in the same order as in class.config and claim.config,
1514
- // with class.config entries first.
1515
- //
1516
- // +optional
1517
- Config []DeviceConfiguration
1518
-
1519
1526
// RequestName identifies the request in the claim which caused this
1520
1527
// device to be allocated. If a request was satisfied by multiple
1521
1528
// devices, they are indexed starting with zero in the order
@@ -1536,21 +1543,14 @@ type RequestAllocationResult struct {
1536
1543
DeviceName string
1537
1544
}
1538
1545
1539
- // DeviceConfiguration is one entry in a list of configuration parameters for a device.
1540
- type DeviceConfiguration struct {
1546
+ // AllocationConfigurationParameters is a superset of ConfigurationParameters which
1547
+ // is used in AllocationResult to track where the parameters came from.
1548
+ type AllocationConfigurationParameters struct {
1541
1549
// Admins is true if the source of the configuration was a class and thus
1542
1550
// not something that a normal user would have been able to set.
1543
1551
Admin bool
1544
1552
1545
- DriverConfigurationParameters
1546
- }
1547
-
1548
- // DriverConfigurationParameters must have one and only one one field set.
1549
- //
1550
- // In contrast to ConfigurationParameters, the driver name is
1551
- // not included and has to be inferred from the context.
1552
- type DriverConfigurationParameters struct {
1553
- Opaque *runtime.RawExtension
1553
+ ConfigurationParameters
1554
1554
}
1555
1555
```
1556
1556
@@ -2699,7 +2699,7 @@ Major milestones might include:
2699
2699
-->
2700
2700
2701
2701
- Kubernetes 1.30: Code merged as extension of v1alpha2
2702
- - Kubernetes 1.31: v1alpha3 with new API and several new features (
2702
+ - Kubernetes 1.31: v1alpha3 with new API and several new features
2703
2703
2704
2704
## Drawbacks
2705
2705
0 commit comments