From a5598f819ee9de8ee94ef84c6f9066bb03eb8b44 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 16 Jan 2025 11:50:13 +0100 Subject: [PATCH 1/3] 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 --- resource/v1alpha3/types.go | 4 ++++ resource/v1beta1/types.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/resource/v1alpha3/types.go b/resource/v1alpha3/types.go index fb4d7041d..49d7c86de 100644 --- a/resource/v1alpha3/types.go +++ b/resource/v1alpha3/types.go @@ -145,6 +145,10 @@ type ResourceSliceSpec struct { Devices []Device `json:"devices" protobuf:"bytes,6,name=devices"` } +// DriverNameMaxLength is the maximum valid length of a driver name in the +// ResourceSliceSpec and other places. It's the same as for CSI driver names. +const DriverNameMaxLength = 63 + // ResourcePool describes the pool that ResourceSlices belong to. type ResourcePool struct { // Name is used to identify the pool. For node-local devices, this diff --git a/resource/v1beta1/types.go b/resource/v1beta1/types.go index ca79c5a66..fbdc35ca8 100644 --- a/resource/v1beta1/types.go +++ b/resource/v1beta1/types.go @@ -144,6 +144,10 @@ type ResourceSliceSpec struct { Devices []Device `json:"devices" protobuf:"bytes,6,name=devices"` } +// DriverNameMaxLength is the maximum valid length of a driver name in the +// ResourceSliceSpec and other places. It's the same as for CSI driver names. +const DriverNameMaxLength = 63 + // ResourcePool describes the pool that ResourceSlices belong to. type ResourcePool struct { // Name is used to identify the pool. For node-local devices, this From 40f4980d02f469796f6c52716467be1632ed9b8d Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Mon, 3 Mar 2025 05:21:16 -0800 Subject: [PATCH 2/3] Merge pull request #129690 from pohly/automated-cherry-pick-of-#129661-origin-release-1.32 Automated cherry pick of #129661: DRA CEL: add missing size estimator Kubernetes-commit: 8207fb465f25081e35d0fd7bad50bf55c8ef4864 From 22c1e39ad8694905cfaad52a473d81f230d61bcb Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 12 Mar 2025 05:42:25 +0000 Subject: [PATCH 3/3] Update dependencies to v0.32.3 tag --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0a8732ce0..d476df7d7 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ godebug winsymlink=0 require ( github.com/gogo/protobuf v1.3.2 - k8s.io/apimachinery v0.0.0-20241206181855-59e9003f02d6 + k8s.io/apimachinery v0.32.3 ) require ( diff --git a/go.sum b/go.sum index a18029ed4..f1efda62e 100644 --- a/go.sum +++ b/go.sum @@ -88,8 +88,8 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/apimachinery v0.0.0-20241206181855-59e9003f02d6 h1:8ccyzZdQXEqpO3sboLCV3yt9bm6VFoO/jYOGS7gCAQs= -k8s.io/apimachinery v0.0.0-20241206181855-59e9003f02d6/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/apimachinery v0.32.3 h1:JmDuDarhDmA/Li7j3aPrwhpNBA94Nvk5zLeOge9HH1U= +k8s.io/apimachinery v0.32.3/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=