Skip to content

Commit d028f77

Browse files
committed
DRA: move DriverName into 3063 KEP
Structured parameters don't use the ResourceClass driver name for anything. All that matters are the driver names in the individual requests and/or filters.
1 parent 3159f89 commit d028f77

File tree

2 files changed

+45
-18
lines changed
  • keps/sig-node

2 files changed

+45
-18
lines changed

keps/sig-node/3063-dynamic-resource-allocation/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,18 @@ plane controller:
256256
type ResourceClass struct {
257257
...
258258

259-
// If (and only if) allocation of claims using this class is handled
260-
// by the DRA driver, ControlPlaneController must be set to true.
259+
// ControllerName defines the name of the dynamic resource driver that is
260+
// used for allocation of a ResourceClaim that uses this class. If empty,
261+
// structured parameters are used for allocating claims using this class.
262+
//
263+
// Resource drivers have a unique name in forward domain order
264+
// (acme.example.com).
261265
//
262266
// This is an alpha field and requires enabling the DRAControlPlaneController
263267
// feature gate.
264-
ControlPlaneController bool
268+
//
269+
// +optional
270+
ControllerName string
265271
}
266272
```
267273

@@ -353,6 +359,15 @@ const (
353359
```
354360
type ResourceClaimStatus struct {
355361
...
362+
// ControllerName is a copy of the driver name from the ResourceClass at
363+
// the time when allocation started. It is empty when the claim was
364+
// allocated through structured parameters,
365+
//
366+
// This is an alpha field and requires enabling the DRAControlPlaneController
367+
// feature gate.
368+
//
369+
// +optional
370+
ControllerName string
356371
357372
// DeallocationRequested indicates that a ResourceClaim is to be
358373
// deallocated.

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

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ apiVersion: core.k8s.io/v1alpha2
447447
kind: ResourceClass
448448
metadata:
449449
name: acme-gpu
450-
driverName: gpu.example.com
451450
parametersRef:
452451
apiGroup: gpu.example.com
453452
kind: GPUInit
@@ -1332,13 +1331,6 @@ type ResourceClass struct {
13321331
// +optional
13331332
metav1.ObjectMeta
13341333
1335-
// DriverName defines the name of the dynamic resource driver that is
1336-
// used for allocation of a ResourceClaim that uses this class.
1337-
//
1338-
// Resource drivers have a unique name in forward domain order
1339-
// (acme.example.com).
1340-
DriverName string
1341-
13421334
// ParametersRef references an arbitrary separate object that may hold
13431335
// parameters that will be used by the driver when allocating a
13441336
// resource that uses this class. A dynamic resource driver can
@@ -1354,6 +1346,14 @@ type ResourceClass struct {
13541346
// Setting this field is optional. If null, all nodes are candidates.
13551347
// +optional
13561348
SuitableNodes *core.NodeSelector
1349+
1350+
// DefaultClaimParametersRef is an optional reference to an object that holds parameters
1351+
// used as default when allocating a claim which references this class. This field is utilized
1352+
// only when the ParametersRef of the claim is nil. If both ParametersRef
1353+
// and DefaultClaimParametersRef are nil, the claim requests no resources and thus
1354+
// can always be allocated.
1355+
// +optional
1356+
DefaultClaimParametersRef *ResourceClassParametersReference
13571357
}
13581358
```
13591359

@@ -1402,7 +1402,7 @@ type NamedResourcesFilter struct {
14021402
// resource instance is suitable. The language is as defined in
14031403
// https://kubernetes.io/docs/reference/using-api/cel/
14041404
//
1405-
// In addition, for each type NamedResourcesin AttributeValue there is a map that
1405+
// In addition, for each type in NamedResourcesAttributeValue there is a map that
14061406
// resolves to the corresponding value of the instance under evaluation.
14071407
// For example:
14081408
//
@@ -1464,6 +1464,7 @@ type ResourceClaimSpec struct {
14641464
// ResourceClassName references the driver and additional parameters
14651465
// via the name of a ResourceClass that was created as part of the
14661466
// driver deployment.
1467+
// +optional
14671468
ResourceClassName string
14681469
14691470
// ParametersRef references a separate object with arbitrary parameters
@@ -1474,15 +1475,26 @@ type ResourceClaimSpec struct {
14741475
// +optional
14751476
ParametersRef *ResourceClaimParametersReference
14761477
}
1478+
```
14771479

1480+
The `ResourceClassName` field may be left empty. The parameters are sufficient
1481+
to determine which driver needs to provide resources. This leads to some corner cases:
1482+
- Empty `ResourceClassName` and nil `ParametersRef`: this is a claim which requests
1483+
no resources. Such a claim can always be allocated with an empty result. Allowing
1484+
this simplifies code generators which dynamically fill in the resource requests
1485+
because they are allowed to generate an empty claim.
1486+
- Non-empty `ResourceClassName`, nil `ParametersRef`, nil
1487+
`ResourceClass.DefaultClaimParametersRef`: this is handled the same way, the
1488+
only difference is that the cluster admin has decided that such claims need
1489+
no resources by not providing default parameters.
1490+
1491+
There is no default ResourceClass. If that is desirable, then it can be
1492+
implemented with a mutating and/or admission webhook.
1493+
1494+
```
14781495
// ResourceClaimStatus tracks whether the resource has been allocated and what
14791496
// the resulting attributes are.
14801497
type ResourceClaimStatus struct {
1481-
// DriverName is a copy of the driver name from the ResourceClass at
1482-
// the time when allocation started.
1483-
// +optional
1484-
DriverName string
1485-
14861498
// Allocation is set by the resource driver once a resource or set of
14871499
// resources has been allocated successfully. If this is not specified, the
14881500
// resources have not been allocated yet.
@@ -1567,7 +1579,7 @@ type NamedResourcesRequest struct {
15671579
// resource instance is suitable. The language is as defined in
15681580
// https://kubernetes.io/docs/reference/using-api/cel/
15691581
//
1570-
// In addition, for each type NamedResourcesin AttributeValue there is a map that
1582+
// In addition, for each type in NamedResourcesAttributeValue there is a map that
15711583
// resolves to the corresponding value of the instance under evaluation.
15721584
// For example:
15731585
//

0 commit comments

Comments
 (0)