diff --git a/pkg/imageverification/imageverifierfunctions/impl.go b/pkg/cel/libs/imageverify/impl.go similarity index 99% rename from pkg/imageverification/imageverifierfunctions/impl.go rename to pkg/cel/libs/imageverify/impl.go index 41ba278210..9b10cfcf18 100644 --- a/pkg/imageverification/imageverifierfunctions/impl.go +++ b/pkg/cel/libs/imageverify/impl.go @@ -1,4 +1,4 @@ -package imageverifierfunctions +package imageverify import ( "context" diff --git a/pkg/imageverification/imageverifierfunctions/impl_test.go b/pkg/cel/libs/imageverify/impl_test.go similarity index 99% rename from pkg/imageverification/imageverifierfunctions/impl_test.go rename to pkg/cel/libs/imageverify/impl_test.go index d059aa966e..62a9455c17 100644 --- a/pkg/imageverification/imageverifierfunctions/impl_test.go +++ b/pkg/cel/libs/imageverify/impl_test.go @@ -1,4 +1,4 @@ -package imageverifierfunctions +package imageverify import ( "testing" diff --git a/pkg/imageverification/imageverifierfunctions/lib.go b/pkg/cel/libs/imageverify/lib.go similarity index 98% rename from pkg/imageverification/imageverifierfunctions/lib.go rename to pkg/cel/libs/imageverify/lib.go index e9703f8847..e065762b94 100644 --- a/pkg/imageverification/imageverifierfunctions/lib.go +++ b/pkg/cel/libs/imageverify/lib.go @@ -1,4 +1,4 @@ -package imageverifierfunctions +package imageverify import ( "context" diff --git a/pkg/imageverification/imageverifierfunctions/utils.go b/pkg/cel/libs/imageverify/utils.go similarity index 97% rename from pkg/imageverification/imageverifierfunctions/utils.go rename to pkg/cel/libs/imageverify/utils.go index 5009da98f6..ad3927a515 100644 --- a/pkg/imageverification/imageverifierfunctions/utils.go +++ b/pkg/cel/libs/imageverify/utils.go @@ -1,4 +1,4 @@ -package imageverifierfunctions +package imageverify import ( "github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1" diff --git a/pkg/imageverification/evaluator/compiler.go b/pkg/imageverification/evaluator/compiler.go index ccfdcae3e3..33cdd0470f 100644 --- a/pkg/imageverification/evaluator/compiler.go +++ b/pkg/imageverification/evaluator/compiler.go @@ -6,11 +6,11 @@ import ( engine "github.com/kyverno/kyverno/pkg/cel" "github.com/kyverno/kyverno/pkg/cel/libs/globalcontext" "github.com/kyverno/kyverno/pkg/cel/libs/http" + "github.com/kyverno/kyverno/pkg/cel/libs/imageverify" "github.com/kyverno/kyverno/pkg/cel/libs/resource" "github.com/kyverno/kyverno/pkg/cel/libs/user" "github.com/kyverno/kyverno/pkg/cel/policy" "github.com/kyverno/kyverno/pkg/imageverification/imagedataloader" - "github.com/kyverno/kyverno/pkg/imageverification/imageverifierfunctions" "github.com/kyverno/kyverno/pkg/imageverification/match" "github.com/kyverno/kyverno/pkg/imageverification/variables" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -57,7 +57,7 @@ func (c *compiler) Compile(ivpolicy *policiesv1alpha1.ImageVerificationPolicy) ( return nil, append(allErrs, field.InternalError(nil, err)) } var declTypes []*apiservercel.DeclType - declTypes = append(declTypes, imageverifierfunctions.Types()...) + declTypes = append(declTypes, imageverify.Types()...) options := []cel.EnvOption{ cel.Variable(ResourceKey, resource.ContextType), cel.Variable(GlobalContextKey, globalcontext.ContextType), @@ -79,7 +79,7 @@ func (c *compiler) Compile(ivpolicy *policiesv1alpha1.ImageVerificationPolicy) ( for _, declType := range declTypes { options = append(options, cel.Types(declType.CelType())) } - options = append(options, imageverifierfunctions.Lib(c.ictx, ivpolicy, c.lister), resource.Lib(), http.Lib(), user.Lib()) + options = append(options, imageverify.Lib(c.ictx, ivpolicy, c.lister), resource.Lib(), http.Lib(), user.Lib()) env, err := base.Extend(options...) if err != nil { return nil, append(allErrs, field.InternalError(nil, err)) diff --git a/pkg/imageverification/evaluator/policy.go b/pkg/imageverification/evaluator/policy.go index ad198e519d..91d6a1ad66 100644 --- a/pkg/imageverification/evaluator/policy.go +++ b/pkg/imageverification/evaluator/policy.go @@ -7,10 +7,10 @@ import ( "github.com/google/cel-go/cel" "github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1" + "github.com/kyverno/kyverno/pkg/cel/libs/imageverify" "github.com/kyverno/kyverno/pkg/cel/policy" "github.com/kyverno/kyverno/pkg/cel/utils" "github.com/kyverno/kyverno/pkg/imageverification/imagedataloader" - "github.com/kyverno/kyverno/pkg/imageverification/imageverifierfunctions" "github.com/kyverno/kyverno/pkg/imageverification/match" "github.com/kyverno/kyverno/pkg/imageverification/variables" "go.uber.org/multierr" @@ -95,7 +95,7 @@ func (c *compiledPolicy) Evaluate(ctx context.Context, ictx imagedataloader.Imag } } - if err := ictx.AddImages(ctx, imgList, imageverifierfunctions.GetRemoteOptsFromPolicy(c.creds)...); err != nil { + if err := ictx.AddImages(ctx, imgList, imageverify.GetRemoteOptsFromPolicy(c.creds)...); err != nil { return nil, err }