Skip to content

Commit

Permalink
DRA: setup -> config parameters, some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pohly committed May 7, 2024
1 parent 359d4d7 commit 198cafb
Showing 1 changed file with 66 additions and 40 deletions.
106 changes: 66 additions & 40 deletions keps/sig-node/4381-dra-structured-parameters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,14 +705,14 @@ generatedFrom:
apiGroup: dra.example.com
uid: foobar-uid
# Setup parameters can be provided at two different levels:
# - for all resources (here)
# - for a single resource (not shown below)
# Configuration parameters can be provided at two different levels:
# - for all resources (this example)
# - for a single resource (example below)
#
# At the moment, only setup parameters defined by a vendor
# are supported. In-tree definition of common setup parameters
# At the moment, only configuration parameters defined by a vendor
# are supported. In-tree definition of common configuration parameters
# might get added in the future.
setup:
config:
vendor:
# The driver name specifies which driver the list entry is intended
# for. This is a list because a claim might end up using resources
Expand All @@ -727,7 +727,7 @@ setup:
# the vendor CRD, so information included here may get visible
# to more users than the original CRD. Both objects are in the same
# namespace.
kind: CardClaimSetup
kind: CardClaimConfiguration
apiVersion: dra.example.com/v1alpha1
sharing:
strategy: TimeSliced
Expand All @@ -750,7 +750,7 @@ namedResources:
# and the existence of attributes doesn't have to be checked.
attributes.version["runtimeVersion"].isGreaterThan(semver("12.0.0")) &&
attributes.quantity["memory"].isGreaterThan(quantity("32Gi"))
``
```

The meaning is that the selector expression must evaluate to true for a
particular named resource which has attributes as defined by
Expand Down Expand Up @@ -782,10 +782,10 @@ metadata:
name: gpu-request-parameters
namespace: user-namespace
- namedResources:
- selector: |-
attributes.bool.has("isGPU.gpu.k8s.io") &&
attributes.bool["isGPU.gpu.k8s.io"]
namedResources:
- selector: |-
attributes.bool.has("isGPU.gpu.k8s.io") &&
attributes.bool["isGPU.gpu.k8s.io"]
```

Vendor parameters could be used here, too. Here they get set at the level of
Expand All @@ -799,16 +799,16 @@ metadata:
name: gpu-request-parameters
namespace: user-namespace
- namedResources:
setup:
namedResources:
- selector: |-
attributes.bool.has("isGPU.gpu.k8s.io") &&
attributes.bool["isGPU.gpu.k8s.io"]
config:
vendor:
- driverName: cards.dra.example.com
parameters: <per-GPU parameters defined by the "cards" vendor>
- driverName: cards.someothervendor.example.com
parameters: <per-GPU parameters defined by the "someothervendor">
- selector: |-
attributes.bool.has("isGPU.gpu.k8s.io") &&
attributes.bool["isGPU.gpu.k8s.io"]
```


Expand Down Expand Up @@ -1437,10 +1437,19 @@ type ResourceClassParameters struct {
// to some unknown type.
GeneratedFrom *ResourceClassParametersReference

// VendorParameters are arbitrary setup parameters for all claims using
// this class. They are ignored while allocating the claim. There must
// not be more than one entry per driver.
VendorParameters []VendorParameters
// ClaimConfig defines configuration parameters that apply to each claim using
// this class. They correspond to ResourceClaimSpec.Config, except that the
// parameters here can only be set by administrators. They are ignored while allocating the claim.
// +optional
ClaimConfig *ConfigurationParameters

// ClaimConfig defines configuration parameters that apply to each individual
// named resource requested by a claim that is using this class. They correspond to
// .Config, except that the
// parameters here can only be set by administrators. They are ignored while allocating the claim.
// +optional
NamedResourcesConfig *ConfigurationParameters


// Filter describes additional contraints that must be met when using the class.
Filter ResourceFilterModel
Expand Down Expand Up @@ -1610,9 +1619,9 @@ type ResourceClaimParameters struct {
// by multiple consumers at the same time.
Shareable bool

// Setup provides optional parameters for configuring all allocated resources.
// ClaimConfig defines configuration parameters that apply to the entire claim.
// They are ignored while allocating the claim.
Setup *SetupParameters
Config *ConfigurationParameters

ResourceRequestModel
}
Expand All @@ -1627,9 +1636,9 @@ type ResourceRequestModel struct {

// NamedResourcesRequest is used in ResourceRequestModel.
type NamedResourcesRequest struct {
// Setup provides optional parameters for configuring the instance.
// They are ignored while allocating the claim.
Setup *SetupParameters
// Config defines configuration parameters that apply to the requested
// instance. They are ignored while allocating the claim.
Config *ConfigurationParameters

// DriverName excludes any named resource not provided by this driver.
// +optional
Expand Down Expand Up @@ -1663,19 +1672,19 @@ type NamedResourcesRequest struct {
}
```

##### SetupParameters
##### ConfigurationParameters

SetupParameters is a one-of-many because in-tree setup parameters might get
ConfigurationParameters is a one-of-many because in-tree configuration parameters might get
defined in the future.

```yaml
// SetupParameters must have one and only one field set.
type SetupParameters struct {
Vendor *[]VendorSetupParameters
// ConfigurationParameters must have one and only one field set.
type ConfigurationParameters struct {
Vendor *[]VendorConfigurationParameters
}

// VendorSetupParameters contains setup parameters per driver.
type VendorSetupParameters struct {
// VendorConfigurationParameters contains setup parameters per driver.
type VendorConfigurationParameters struct {
// DriverName is used to determine which kubelet plugin needs
// to be passed these setup parameters.
//
Expand Down Expand Up @@ -1743,14 +1752,20 @@ type ResourceHandle struct {

// StructuredResourceHandle is the in-tree representation of the allocation result.
type StructuredResourceHandle struct {
// VendorClassParameters are the per-claim configuration parameters
// AdminConfig are the per-claim configuration parameters
// from the resource class at the time that the claim was allocated.
VendorClassParameters runtime.Object
//
// This is a verbatim copy, so it may include parameters defined for
// some other driver than the one providing the resource.
AdminConfig *ConfigurationParameters

// Setup are the per-claim configuration parameters
// UserConfig are the per-claim configuration parameters
// from the resource claim parameters at the time that the claim was
// allocated.
Setup *SetupParameters
//
// This is a verbatim copy, so it may include parameters defined for
// some other driver than the one providing the resource.
UserConfig *ConfigurationParameters

// NodeName is the name of the node providing the necessary resources
// if the resources are local to a node.
Expand All @@ -1763,9 +1778,20 @@ type StructuredResourceHandle struct {
// DriverAllocationResult contains vendor parameters and the allocation result for
// one request.
type DriverAllocationResult struct {
// VendorRequestParameters are the per-request configuration parameters
// from the time that the claim was allocated.
VendorRequestParameters runtime.Object
// AdminConfig are the per-instance configuration parameters
// from the resource class at the time that the claim was allocated.
//
// This is a verbatim copy, so it may include parameters defined for
// some other driver than the one providing the resource.
AdminConfig *ConfigurationParameters

// UserConfig are the per-instance configuration parameters
// from the resource claim parameters at the time that the claim was
// allocated.
//
// This is a verbatim copy, so it may include parameters defined for
// some other driver than the one providing the resource.
UserConfig *ConfigurationParameters

AllocationResultModel
}
Expand Down

0 comments on commit 198cafb

Please sign in to comment.