1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-24 08:36:46 +00:00

chore: move imageverify cel lib (#12449)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2025-03-19 09:28:35 +01:00 committed by GitHub
parent c762fe8d9d
commit d3305512d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
package imageverifierfunctions
package imageverify
import (
"context"

View file

@ -1,4 +1,4 @@
package imageverifierfunctions
package imageverify
import (
"testing"

View file

@ -1,4 +1,4 @@
package imageverifierfunctions
package imageverify
import (
"context"

View file

@ -1,4 +1,4 @@
package imageverifierfunctions
package imageverify
import (
"github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1"

View file

@ -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))

View file

@ -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
}