Skip to content

Commit b9ea723

Browse files
committed
DRA: review feedback
Mostly: - removal of quota API - config parameters only under claim.spec
1 parent 01d4f4f commit b9ea723

File tree

1 file changed

+79
-79
lines changed
  • keps/sig-node/4381-dra-structured-parameters

1 file changed

+79
-79
lines changed

keps/sig-node/4381-dra-structured-parameters/README.md

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,6 @@ of the cluster in an allocated state.
11901190

11911191
```go
11921192
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-
11971193
// Requests are individual requests for separate resources for the claim.
11981194
// An empty list is valid and means that the claim can always be allocated
11991195
// without needing anything. A class can be referenced to use the default
@@ -1202,9 +1198,13 @@ type ResourceClaimSpec struct {
12021198
// +listType=atomic
12031199
Requests []Request
12041200

1201+
// These constraints must be satisfied by the set of devices that get
1202+
// allocated for the claim.
1203+
Constraints []Constraint
1204+
12051205
// 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.
12081208
//
12091209
// +optional
12101210
// +listType=atomic
@@ -1217,36 +1217,6 @@ type ResourceClaimSpec struct {
12171217
// Score *SomeScoringStruct
12181218
}
12191219

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-
12501220
// Request is a request for one of many resources required for a claim.
12511221
// This is typically a request for a single resource like a device, but can
12521222
// also ask for several identical devices. It might get extended to support
@@ -1258,7 +1228,7 @@ type Request struct {
12581228
// Must be a DNS label.
12591229
Name string
12601230

1261-
*ResourceRequestDetail
1231+
*RequestDetail
12621232

12631233
// FUTURE EXTENSION:
12641234
//
@@ -1267,10 +1237,10 @@ type Request struct {
12671237
//
12681238
// +optional
12691239
// +listType=atomic
1270-
// OneOf []ResourceRequestDetail
1240+
// OneOf []RequestDetail
12711241
}
12721242

1273-
type ResourceRequestDetail struct {
1243+
type RequestDetail struct {
12741244
// When referencing a DeviceClass, a request inherits additional
12751245
// configuration and selectors.
12761246
//
@@ -1285,13 +1255,6 @@ type ResourceRequestDetail struct {
12851255

12861256
*Amount // inline, so no extra level in YAML and no separate documentation
12871257

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-
12951258
// AdminAccess indicates that this is a claim for administrative access
12961259
// to the device(s). Claims with AdminAccess are expected to be used for
12971260
// monitoring or other management services for a device. They ignore
@@ -1340,6 +1303,21 @@ type Selector struct {
13401303
// +optional
13411304
Expression *string
13421305
}
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
13431321

13441322
// Exactly one field must be set.
13451323
type Amount struct {
@@ -1361,8 +1339,45 @@ type Amount struct {
13611339
Count *int64
13621340
}
13631341

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.
13651373
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+
13661381
Opaque *OpaqueConfigurationParameters
13671382
}
13681383

@@ -1471,18 +1486,22 @@ type DeviceClass struct {
14711486
```go
14721487
// AllocationResult contains attributes of an allocated resource.
14731488
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.
14771490
//
1478-
// +optional
14791491
// +listType=atomic
1480-
Config []ConfigurationParameters
1492+
Results []RequestAllocationResult
14811493

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.
14831501
//
1502+
// +optional
14841503
// +listType=atomic
1485-
Results []RequestAllocationResult
1504+
Config []AllocationConfigurationParameters
14861505

14871506
// Setting this field is optional. If unset, the allocated devices are available everywhere.
14881507
//
@@ -1494,8 +1513,7 @@ type AllocationResult struct {
14941513
// entries in allocation.results.
14951514
const AllocationResultsMaxSize = 32
14961515

1497-
// RequestAllocationResult contains configuration and the allocation result for
1498-
// one request.
1516+
// RequestAllocationResult contains the allocation result for one request.
14991517
type RequestAllocationResult struct {
15001518
// DriverName specifies the name of the DRA driver whose kubelet
15011519
// plugin should be invoked to process the allocation once the claim is
@@ -1505,17 +1523,6 @@ type RequestAllocationResult struct {
15051523
// vendor of the driver.
15061524
DriverName string
15071525

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-
15191526
// RequestName identifies the request in the claim which caused this
15201527
// device to be allocated. If a request was satisfied by multiple
15211528
// devices, they are indexed starting with zero in the order
@@ -1536,21 +1543,14 @@ type RequestAllocationResult struct {
15361543
DeviceName string
15371544
}
15381545

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 {
15411549
// Admins is true if the source of the configuration was a class and thus
15421550
// not something that a normal user would have been able to set.
15431551
Admin bool
15441552

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
15541554
}
15551555
```
15561556

@@ -2699,7 +2699,7 @@ Major milestones might include:
26992699
-->
27002700

27012701
- 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
27032703

27042704
## Drawbacks
27052705

0 commit comments

Comments
 (0)