generate

package
v1.6.10 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Skip : failed to process rule, will not update the resource
	Skip ResourceMode = "SKIP"
	//Create : create a new resource
	Create = "CREATE"
	//Update : update/overwrite the new resource
	Update = "UPDATE"
)

Variables

This section is empty.

Functions

func PatchGenerateRequest added in v1.6.0

func PatchGenerateRequest(gr *kyverno.GenerateRequest, patch []PatchOp, client kyvernoclient.Interface, subresources ...string) (*kyverno.GenerateRequest, error)

PatchGenerateRequest patches a generate request object

func ValidateResourceWithPattern added in v1.3.5

func ValidateResourceWithPattern(log logr.Logger, resource, pattern interface{}) (string, error)

ValidateResourceWithPattern is a start of element-by-element validation process It assumes that validation is started from root, so "/" is passed Anchors are not expected in the pattern

Types

type ConfigNotFound

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

ConfigNotFound stores the config information

func NewConfigNotFound

func NewConfigNotFound(config interface{}, kind, namespace, name string) *ConfigNotFound

NewConfigNotFound returns a new NewConfigNotFound error

func (*ConfigNotFound) Error

func (e *ConfigNotFound) Error() string

type Controller

type Controller struct {
	Config config.Interface
	// contains filtered or unexported fields
}

Controller manages the life-cycle for Generate-Requests and applies generate rule

func NewController

func NewController(
	kubeClient kubernetes.Interface,
	kyvernoClient *kyvernoclient.Clientset,
	client *dclient.Client,
	policyInformer kyvernoinformer.ClusterPolicyInformer,
	grInformer kyvernoinformer.GenerateRequestInformer,
	eventGen event.Interface,
	dynamicInformer dynamicinformer.DynamicSharedInformerFactory,
	log logr.Logger,
	dynamicConfig config.Interface,
) (*Controller, error)

NewController returns an instance of the Generate-Request Controller

func (*Controller) EnqueueGenerateRequestFromWebhook added in v1.3.0

func (c *Controller) EnqueueGenerateRequestFromWebhook(gr *kyverno.GenerateRequest)

EnqueueGenerateRequestFromWebhook - enqueueing generate requests from webhook

func (*Controller) Run

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

Run starts workers

type Handler added in v1.3.5

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

func NewHandler added in v1.3.5

func NewHandler(element string, pattern interface{}, path string) Handler

func (Handler) Handle added in v1.3.5

func (dh Handler) Handle(handler resourceElementHandler, resourceMap map[string]interface{}, originPattern interface{}) (string, error)

type NotFound

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

NotFound stores the resource that was not found

func NewNotFound

func NewNotFound(kind, namespace, name string) *NotFound

NewNotFound returns a new NotFound error

func (*NotFound) Error

func (e *NotFound) Error() string

type ParseFailed

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

ParseFailed stores the resource that failed to parse

func NewParseFailed

func NewParseFailed(spec interface{}, err error) *ParseFailed

NewParseFailed returns a new ParseFailed error

func (*ParseFailed) Error

func (e *ParseFailed) Error() string

type PatchOp added in v1.6.0

type PatchOp struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value,omitempty"`
}

PatchOp represents a json patch operation

type ResourceMode added in v1.2.0

type ResourceMode string

ResourceMode defines the mode for generated resource

type StatusControl

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

StatusControl is default implementaation of GRStatusControlInterface

func (StatusControl) Failed

func (sc StatusControl) Failed(gr kyverno.GenerateRequest, message string, genResources []kyverno.ResourceSpec) error

Failed sets gr status.state to failed with message

func (StatusControl) Skip added in v1.6.0

func (sc StatusControl) Skip(gr kyverno.GenerateRequest, genResources []kyverno.ResourceSpec) error

Success sets the gr status.state to completed and clears message

func (StatusControl) Success

func (sc StatusControl) Success(gr kyverno.GenerateRequest, genResources []kyverno.ResourceSpec) error

Success sets the gr status.state to completed and clears message

type StatusControlInterface

type StatusControlInterface interface {
	Failed(gr kyverno.GenerateRequest, message string, genResources []kyverno.ResourceSpec) error
	Success(gr kyverno.GenerateRequest, genResources []kyverno.ResourceSpec) error
	Skip(gr kyverno.GenerateRequest, genResources []kyverno.ResourceSpec) error
}

StatusControlInterface provides interface to update status subresource

type Violation

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

Violation stores the rule that violated

func NewViolation

func NewViolation(rule string, err error) *Violation

NewViolation returns a new Violation error

func (*Violation) Error

func (e *Violation) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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