@@ -447,7 +447,6 @@ apiVersion: core.k8s.io/v1alpha2
447
447
kind: ResourceClass
448
448
metadata:
449
449
name: acme-gpu
450
- driverName: gpu.example.com
451
450
parametersRef:
452
451
apiGroup: gpu.example.com
453
452
kind: GPUInit
@@ -1332,13 +1331,6 @@ type ResourceClass struct {
1332
1331
// +optional
1333
1332
metav1.ObjectMeta
1334
1333
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
-
1342
1334
// ParametersRef references an arbitrary separate object that may hold
1343
1335
// parameters that will be used by the driver when allocating a
1344
1336
// resource that uses this class. A dynamic resource driver can
@@ -1354,6 +1346,14 @@ type ResourceClass struct {
1354
1346
// Setting this field is optional. If null, all nodes are candidates.
1355
1347
// +optional
1356
1348
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
1357
1357
}
1358
1358
` ` `
1359
1359
@@ -1402,7 +1402,7 @@ type NamedResourcesFilter struct {
1402
1402
// resource instance is suitable. The language is as defined in
1403
1403
// https://kubernetes.io/docs/reference/using-api/cel/
1404
1404
//
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
1406
1406
// resolves to the corresponding value of the instance under evaluation.
1407
1407
// For example:
1408
1408
//
@@ -1464,6 +1464,7 @@ type ResourceClaimSpec struct {
1464
1464
// ResourceClassName references the driver and additional parameters
1465
1465
// via the name of a ResourceClass that was created as part of the
1466
1466
// driver deployment.
1467
+ // +optional
1467
1468
ResourceClassName string
1468
1469
1469
1470
// ParametersRef references a separate object with arbitrary parameters
@@ -1474,15 +1475,26 @@ type ResourceClaimSpec struct {
1474
1475
// +optional
1475
1476
ParametersRef *ResourceClaimParametersReference
1476
1477
}
1478
+ ` ` `
1477
1479
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
+ ```
1478
1495
// ResourceClaimStatus tracks whether the resource has been allocated and what
1479
1496
// the resulting attributes are.
1480
1497
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
-
1486
1498
// Allocation is set by the resource driver once a resource or set of
1487
1499
// resources has been allocated successfully. If this is not specified, the
1488
1500
// resources have not been allocated yet.
@@ -1567,7 +1579,7 @@ type NamedResourcesRequest struct {
1567
1579
// resource instance is suitable. The language is as defined in
1568
1580
// https://kubernetes.io/docs/reference/using-api/cel/
1569
1581
//
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
1571
1583
// resolves to the corresponding value of the instance under evaluation.
1572
1584
// For example:
1573
1585
//
0 commit comments