mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-06 02:26:07 +00:00
DRA cel: enforce runtime limit by default again
As pointed out during code review, the CEL cost estimates are not considered perfectly reliable. Therefore it is better to also do runtime checks. Some downstream users might decide to allow CEL expressions to run longer. Therefore the cost limit is now part of an Options struct. kube-scheduler uses the default cost limit defined in the resource.k8s.io API, which is the same cost limit that also the apiserver uses during validation.
This commit is contained in:
@@ -176,7 +176,7 @@ func validateCELSelector(celSelector resource.CELDeviceSelector, fldPath *field.
|
||||
return allErrs
|
||||
}
|
||||
|
||||
result := dracel.GetCompiler().CompileCELExpression(celSelector.Expression, envType)
|
||||
result := dracel.GetCompiler().CompileCELExpression(celSelector.Expression, dracel.Options{EnvType: &envType})
|
||||
if result.Error != nil {
|
||||
allErrs = append(allErrs, convertCELErrorToValidationError(fldPath.Child("expression"), celSelector.Expression, result.Error))
|
||||
} else if result.MaxCost > resource.CELSelectorExpressionMaxCost {
|
||||
|
Reference in New Issue
Block a user