mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 02:45:06 +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:
parent
c762fe8d9d
commit
d3305512d4
6 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
package imageverifierfunctions
|
package imageverify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
|
@ -1,4 +1,4 @@
|
||||||
package imageverifierfunctions
|
package imageverify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package imageverifierfunctions
|
package imageverify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
|
@ -1,4 +1,4 @@
|
||||||
package imageverifierfunctions
|
package imageverify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1"
|
"github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1"
|
|
@ -6,11 +6,11 @@ import (
|
||||||
engine "github.com/kyverno/kyverno/pkg/cel"
|
engine "github.com/kyverno/kyverno/pkg/cel"
|
||||||
"github.com/kyverno/kyverno/pkg/cel/libs/globalcontext"
|
"github.com/kyverno/kyverno/pkg/cel/libs/globalcontext"
|
||||||
"github.com/kyverno/kyverno/pkg/cel/libs/http"
|
"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/resource"
|
||||||
"github.com/kyverno/kyverno/pkg/cel/libs/user"
|
"github.com/kyverno/kyverno/pkg/cel/libs/user"
|
||||||
"github.com/kyverno/kyverno/pkg/cel/policy"
|
"github.com/kyverno/kyverno/pkg/cel/policy"
|
||||||
"github.com/kyverno/kyverno/pkg/imageverification/imagedataloader"
|
"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/match"
|
||||||
"github.com/kyverno/kyverno/pkg/imageverification/variables"
|
"github.com/kyverno/kyverno/pkg/imageverification/variables"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
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))
|
return nil, append(allErrs, field.InternalError(nil, err))
|
||||||
}
|
}
|
||||||
var declTypes []*apiservercel.DeclType
|
var declTypes []*apiservercel.DeclType
|
||||||
declTypes = append(declTypes, imageverifierfunctions.Types()...)
|
declTypes = append(declTypes, imageverify.Types()...)
|
||||||
options := []cel.EnvOption{
|
options := []cel.EnvOption{
|
||||||
cel.Variable(ResourceKey, resource.ContextType),
|
cel.Variable(ResourceKey, resource.ContextType),
|
||||||
cel.Variable(GlobalContextKey, globalcontext.ContextType),
|
cel.Variable(GlobalContextKey, globalcontext.ContextType),
|
||||||
|
@ -79,7 +79,7 @@ func (c *compiler) Compile(ivpolicy *policiesv1alpha1.ImageVerificationPolicy) (
|
||||||
for _, declType := range declTypes {
|
for _, declType := range declTypes {
|
||||||
options = append(options, cel.Types(declType.CelType()))
|
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...)
|
env, err := base.Extend(options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, append(allErrs, field.InternalError(nil, err))
|
return nil, append(allErrs, field.InternalError(nil, err))
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
|
|
||||||
"github.com/google/cel-go/cel"
|
"github.com/google/cel-go/cel"
|
||||||
"github.com/kyverno/kyverno/api/policies.kyverno.io/v1alpha1"
|
"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/policy"
|
||||||
"github.com/kyverno/kyverno/pkg/cel/utils"
|
"github.com/kyverno/kyverno/pkg/cel/utils"
|
||||||
"github.com/kyverno/kyverno/pkg/imageverification/imagedataloader"
|
"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/match"
|
||||||
"github.com/kyverno/kyverno/pkg/imageverification/variables"
|
"github.com/kyverno/kyverno/pkg/imageverification/variables"
|
||||||
"go.uber.org/multierr"
|
"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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue