diff --git a/staging/src/k8s.io/apiserver/pkg/cel/types.go b/staging/src/k8s.io/apiserver/pkg/cel/types.go index bd14e169744..53832d7843a 100644 --- a/staging/src/k8s.io/apiserver/pkg/cel/types.go +++ b/staging/src/k8s.io/apiserver/pkg/cel/types.go @@ -28,6 +28,7 @@ import ( exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" "google.golang.org/protobuf/proto" + "k8s.io/apimachinery/pkg/api/resource" ) const ( @@ -576,6 +577,10 @@ var ( // labeled as Timestamp will necessarily have the same MinSerializedSize. TimestampType = NewSimpleTypeWithMinSize("timestamp", cel.TimestampType, types.Timestamp{Time: time.Time{}}, JSONDateSize) + // QuantityDeclType wraps a [QuantityType] and makes it usable with functions that expect + // a [DeclType]. + QuantityDeclType = NewSimpleTypeWithMinSize("quantity", QuantityType, Quantity{Quantity: resource.NewQuantity(0, resource.DecimalSI)}, 8) + // UintType is equivalent to the CEL 'uint' type. UintType = NewSimpleTypeWithMinSize("uint", cel.UintType, types.Uint(0), 1)