2019-11-08 18:57:27 -08:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
2020-10-07 11:12:31 -07:00
|
|
|
kyverno "github.com/kyverno/kyverno/pkg/api/kyverno/v1"
|
|
|
|
client "github.com/kyverno/kyverno/pkg/dclient"
|
|
|
|
"github.com/kyverno/kyverno/pkg/engine/context"
|
|
|
|
"github.com/kyverno/kyverno/pkg/resourcecache"
|
2019-11-08 18:57:27 -08:00
|
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PolicyContext contains the contexts for engine to process
|
|
|
|
type PolicyContext struct {
|
2020-12-16 12:29:16 -08:00
|
|
|
|
|
|
|
// Policy is the policy to be processed
|
2019-11-08 18:57:27 -08:00
|
|
|
Policy kyverno.ClusterPolicy
|
2020-12-16 12:29:16 -08:00
|
|
|
|
|
|
|
// NewResource is the resource to be processed
|
2019-11-13 13:13:07 -08:00
|
|
|
NewResource unstructured.Unstructured
|
2020-12-16 12:29:16 -08:00
|
|
|
|
|
|
|
// OldResource is the prior resource for an update, or nil
|
|
|
|
OldResource unstructured.Unstructured
|
|
|
|
|
|
|
|
// AdmissionInfo contains the admission request information
|
2020-01-07 10:33:28 -08:00
|
|
|
AdmissionInfo kyverno.RequestInfo
|
2020-12-16 12:29:16 -08:00
|
|
|
|
2019-11-13 15:46:43 -08:00
|
|
|
// Dynamic client - used by generate
|
|
|
|
Client *client.Client
|
2020-12-16 12:29:16 -08:00
|
|
|
|
2020-08-07 17:09:24 -07:00
|
|
|
// Config handler
|
|
|
|
ExcludeGroupRole []string
|
2020-09-23 02:41:49 +05:30
|
|
|
|
2020-12-16 12:29:16 -08:00
|
|
|
ExcludeResourceFunc func(kind, namespace, name string) bool
|
|
|
|
|
|
|
|
// ResourceCache provides listers to resources. Currently Supports Configmap
|
2021-01-29 17:38:23 -08:00
|
|
|
ResourceCache resourcecache.ResourceCache
|
2020-12-16 12:29:16 -08:00
|
|
|
|
|
|
|
// JSONContext is the variable context
|
2020-09-23 02:41:49 +05:30
|
|
|
JSONContext *context.Context
|
2019-11-08 18:57:27 -08:00
|
|
|
}
|