Skip to content

Commit 148469d

Browse files
committed
DRA API: update some comments
Mentioning potential future API extensions help with understanding why the API is defined the way it is when reading just the types.go. Those stand-alone comments appear neither in the Go doc nor OpenAPI. This corresponds to kubernetes/enhancements#4808.
1 parent 9fe0662 commit 148469d

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

pkg/apis/resource/types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ type DeviceClaim struct {
362362
// +optional
363363
// +listType=atomic
364364
Config []DeviceClaimConfiguration
365+
366+
// Potential future extension, ignored by older schedulers. This is
367+
// fine because scoring allows users to define a preference, without
368+
// making it a hard requirement.
369+
//
370+
// Score *SomeScoringStruct
365371
}
366372

367373
const (
@@ -552,6 +558,16 @@ type DeviceConstraint struct {
552558
// +optional
553559
// +oneOf=ConstraintType
554560
MatchAttribute *FullyQualifiedName
561+
562+
// Potential future extension, not part of the current design:
563+
// A CEL expression which compares different devices and returns
564+
// true if they match.
565+
//
566+
// Because it would be part of a one-of, old schedulers will not
567+
// accidentally ignore this additional, for them unknown match
568+
// criteria.
569+
//
570+
// MatchExpression string
555571
}
556572

557573
// DeviceClaimConfiguration is used for configuration parameters in DeviceClaim.

staging/src/k8s.io/api/resource/v1alpha3/types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ type DeviceClaim struct {
368368
// +optional
369369
// +listType=atomic
370370
Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"`
371+
372+
// Potential future extension, ignored by older schedulers. This is
373+
// fine because scoring allows users to define a preference, without
374+
// making it a hard requirement.
375+
//
376+
// Score *SomeScoringStruct
371377
}
372378

373379
const (
@@ -558,6 +564,16 @@ type DeviceConstraint struct {
558564
// +optional
559565
// +oneOf=ConstraintType
560566
MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"`
567+
568+
// Potential future extension, not part of the current design:
569+
// A CEL expression which compares different devices and returns
570+
// true if they match.
571+
//
572+
// Because it would be part of a one-of, old schedulers will not
573+
// accidentally ignore this additional, for them unknown match
574+
// criteria.
575+
//
576+
// MatchExpression string
561577
}
562578

563579
// DeviceClaimConfiguration is used for configuration parameters in DeviceClaim.

staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/api.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/api.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ message NodePrepareResourceResponse {
6767
// may have zero or more devices.
6868
repeated Device devices = 1;
6969
// If non-empty, preparing the ResourceClaim failed.
70-
// cdi_devices is ignored in that case.
70+
// Devices are ignored in that case.
7171
string error = 2;
7272
}
7373

0 commit comments

Comments
 (0)