Created
January 14, 2025 05:39
-
-
Save ihcsim/3f48db3ec661718281c49c314fe7edef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ForInput evaluates the compiled CEL expressions converting them into CELEvaluations | |
// errors per evaluation are returned on the Evaluation object | |
// runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. | |
func (c *condition) ForInput(ctx context.Context, versionedAttr *admission.VersionedAttributes, request *admissionv1.AdmissionRequest, inputs OptionalVariableBindings, namespace *v1.Namespace, runtimeCELCostBudget int64) ([]EvaluationResult, int64, error) { | |
// ... | |
remainingBudget := runtimeCELCostBudget | |
for i, compilationResult := range c.compilationResults { | |
evaluations[i], remainingBudget, err = activation.Evaluate(ctx, compositionCtx, compilationResult, remainingBudget) | |
if err != nil { | |
return nil, -1, err | |
} | |
} | |
return evaluations, remainingBudget, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment