policycache

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Cache Interface
	// contains filtered or unexported fields
}

Controller is responsible for synchronizing Policy Cache, it embeds a policy informer to handle policy events. The cache is synced when a policy is add/update/delete. This cache is only used in the admission webhook to fast retrieve policies based on types (Mutate/ValidateEnforce/Generate).

func NewPolicyCacheController

func NewPolicyCacheController(
	pInformer kyvernoinformer.ClusterPolicyInformer,
	nspInformer kyvernoinformer.PolicyInformer,
	log logr.Logger) *Controller

NewPolicyCacheController create a new PolicyController

func (*Controller) Run

func (c *Controller) Run(workers int, stopCh <-chan struct{})

Run waits until policy informer to be synced

type Interface

type Interface interface {

	// Add adds a policy to the cache
	Add(policy *kyverno.ClusterPolicy)

	// Remove removes a policy from the cache
	Remove(policy *kyverno.ClusterPolicy)

	// GetPolicies returns all policies that apply to a namespace, including cluster-wide policies
	// If the namespace is empty, only cluster-wide policies are returned
	GetPolicies(pkey PolicyType, kind string, nspace string) []*kyverno.ClusterPolicy
	// contains filtered or unexported methods
}

Interface ... Interface get method use for to get policy names and mostly use to test cache testcases

type PolicyType

type PolicyType uint8

PolicyType represents types of policies

const (
	Mutate PolicyType = 1 << iota
	ValidateEnforce
	ValidateAudit
	Generate
	VerifyImages
)

Types of policies

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL