kyverno

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyKind        = "Policy"
	ClusterPolicyKind = "ClusterPolicy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v1.0.0

type Event = int

Event Enum

const (
	Added Event = iota
	Updated
	Deleted
)

Possible Policy Event Enums

type EventPublisher added in v1.0.0

type EventPublisher struct {
	// contains filtered or unexported fields
}

func NewEventPublisher added in v1.0.0

func NewEventPublisher() *EventPublisher

NewEventPublisher constructure for EventPublisher

func (*EventPublisher) GetListener added in v1.0.0

func (p *EventPublisher) GetListener() []PolicyListener

GetListener returns a list of all registered Listeners

func (*EventPublisher) Publish added in v1.0.0

func (p *EventPublisher) Publish(event LifecycleEvent)

Publish events to the registered listeners

func (*EventPublisher) RegisterListener added in v1.0.0

func (p *EventPublisher) RegisterListener(listener PolicyListener)

RegisterListener register Handlers called on each PolicyReport watch.Event

type LifecycleEvent added in v1.0.0

type LifecycleEvent struct {
	Type   Event
	Policy Policy
}

LifecycleEvent of Policys

type Policy

type Policy struct {
	Kind                    string    `json:"kind"`
	APIVersion              string    `json:"apiVersion"`
	Name                    string    `json:"name"`
	Namespace               string    `json:"namespace,omitempty"`
	AutogenControllers      []string  `json:"autogenControllers,omitempty"`
	ValidationFailureAction string    `json:"validationFailureAction,omitempty"`
	Background              *bool     `json:"background"`
	Rules                   []*Rule   `json:"rules"`
	Category                string    `json:"category,omitempty"`
	Description             string    `json:"description,omitempty"`
	Severity                string    `json:"severity,omitempty"`
	CreationTimestamp       time.Time `json:"creationTimestamp,omitempty"`
	UID                     string    `json:"uid,omitempty"`
	Content                 string    `json:"content"`
}

Policy spec clusterpolicies.kyverno.io/v1.Policy

func (*Policy) GetID added in v1.5.1

func (p *Policy) GetID() string

type PolicyClient

type PolicyClient interface {
	// Run watches for Policy Events
	Run(int, chan struct{}) error
	// HasSynced all CRDs
	HasSynced() bool
}

PolicyClient to watch for LifecycleEvents in the cluster

type PolicyListener added in v1.0.0

type PolicyListener = func(LifecycleEvent)

PolicyListener is called whenver a new Policy comes in

type PolicyStore

type PolicyStore struct {
	// contains filtered or unexported fields
}

PolicyStore persists the last state of a Policy in memory

func NewPolicyStore

func NewPolicyStore() *PolicyStore

NewPolicyStore returns a pointer to a new in memory store

func (*PolicyStore) Add

func (s *PolicyStore) Add(r Policy)

Add a Policy to the store

func (*PolicyStore) Get

func (s *PolicyStore) Get(id string) (Policy, bool)

Get a Policy from the Store by ID

func (*PolicyStore) List

func (s *PolicyStore) List() []Policy

List all stored Policies

func (*PolicyStore) Remove

func (s *PolicyStore) Remove(id string)

Remove a Policy to the store

type Rule

type Rule struct {
	ValidateMessage string         `json:"message,omitempty"`
	Name            string         `json:"name"`
	Type            string         `json:"type"`
	VerifyImages    []*VerifyImage `json:"verifyImages,omitempty"`
}

Rule from the Policy spec clusterpolicies.kyverno.io/v1.Policy

type VerifyImage added in v1.1.0

type VerifyImage struct {
	Attestations string `json:"attestations,omitempty"`
	Repository   string `json:"repository"`
	Image        string `json:"image"`
	Key          string `json:"key"`
}

VerifyImage from the Policy spec clusterpolicies.kyverno.io/v1.Policy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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