Skip to content

Commit

Permalink
adjust code to movel cel constants
Browse files Browse the repository at this point in the history
  • Loading branch information
xrstf committed Oct 18, 2023
1 parent 6240eb4 commit 7f91070
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sdk/apis/test/cel.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apimachinery/pkg/util/yaml"
celconfig "k8s.io/apiserver/pkg/apis/cel"
)

// FieldValidatorsFromFile extracts the CEL validators by version and JSONPath from a CRD file and returns
Expand Down Expand Up @@ -76,7 +77,7 @@ func VersionValidatorsFromFile(t *testing.T, crdFilePath string) map[string]CELV
structuralSchema, err := schema.NewStructural(&internalSchema)
require.NoError(t, err, "failed to create StructuralSchema for version %s: %v", v.Name, err)
ret[v.Name] = func(obj, old interface{}) field.ErrorList {
errs, _ := cel.NewValidator(structuralSchema, true, cel.RuntimeCELCostBudget).Validate(context.TODO(), nil, structuralSchema, obj, old, cel.PerCallLimit)
errs, _ := cel.NewValidator(structuralSchema, true, celconfig.RuntimeCELCostBudget).Validate(context.TODO(), nil, structuralSchema, obj, old, celconfig.PerCallLimit)
return errs
}
}
Expand Down Expand Up @@ -104,7 +105,7 @@ func findCEL(t *testing.T, s *schema.Structural, root bool, pth *field.Path) (ma
s := *s
pth := *pth
ret[pth.String()] = func(obj, old interface{}) field.ErrorList {
errs, _ := cel.NewValidator(&s, root, cel.RuntimeCELCostBudget).Validate(context.TODO(), &pth, &s, obj, old, cel.PerCallLimit)
errs, _ := cel.NewValidator(&s, root, celconfig.RuntimeCELCostBudget).Validate(context.TODO(), &pth, &s, obj, old, celconfig.PerCallLimit)
return errs
}
}
Expand Down

0 comments on commit 7f91070

Please sign in to comment.