Skip to content

Commit a5598f8

Browse files
pohlyk8s-publishing-bot
authored andcommitted
DRA CEL: add missing size estimator
Not implementing a size estimator had the effect that strings retrieved from the attributes were treated as "unknown size", leading to wildly overestimating the cost and validation errors even for even simple expressions like this: device.attributes["qat.intel.com"].services.matches("[^a]?sym") Maximum number of elements in maps and the maximum length of the driver name string were also ignored resp. missing. Pre-defined types like apiservercel.StringType must be avoided because they are defined as having a zero maximum size. Kubernetes-commit: f89e4c08cfe37ba0303a3994ce6e78765231b518
1 parent 25d8df3 commit a5598f8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

resource/v1alpha3/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ type ResourceSliceSpec struct {
145145
Devices []Device `json:"devices" protobuf:"bytes,6,name=devices"`
146146
}
147147

148+
// DriverNameMaxLength is the maximum valid length of a driver name in the
149+
// ResourceSliceSpec and other places. It's the same as for CSI driver names.
150+
const DriverNameMaxLength = 63
151+
148152
// ResourcePool describes the pool that ResourceSlices belong to.
149153
type ResourcePool struct {
150154
// Name is used to identify the pool. For node-local devices, this

resource/v1beta1/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ type ResourceSliceSpec struct {
144144
Devices []Device `json:"devices" protobuf:"bytes,6,name=devices"`
145145
}
146146

147+
// DriverNameMaxLength is the maximum valid length of a driver name in the
148+
// ResourceSliceSpec and other places. It's the same as for CSI driver names.
149+
const DriverNameMaxLength = 63
150+
147151
// ResourcePool describes the pool that ResourceSlices belong to.
148152
type ResourcePool struct {
149153
// Name is used to identify the pool. For node-local devices, this

0 commit comments

Comments
 (0)