generate

package
v1.8.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 37 Imported by: 1

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 GetUnstrRule added in v1.8.0

func GetUnstrRule(rule *kyvernov1.Generation) (*unstructured.Unstructured, error)

func ValidateResourceWithPattern

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 GenerateController

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

func NewGenerateController

NewGenerateController returns an instance of the Generate-Request Controller

func NewGenerateControllerWithOnlyClient added in v1.8.0

func NewGenerateControllerWithOnlyClient(client dclient.Interface) *GenerateController

NewGenerateControllerWithOnlyClient returns an instance of Controller with only the client.

func (*GenerateController) ApplyGeneratePolicy added in v1.8.0

func (c *GenerateController) ApplyGeneratePolicy(log logr.Logger, policyContext *engine.PolicyContext, ur kyvernov1beta1.UpdateRequest, applicableRules []string) (genResources []kyvernov1.ResourceSpec, processExisting bool, err error)

func (*GenerateController) ApplyResource added in v1.8.0

func (c *GenerateController) ApplyResource(resource *unstructured.Unstructured) error

func (*GenerateController) GetUnstrResource added in v1.8.0

func (c *GenerateController) GetUnstrResource(genResourceSpec kyvernov1.ResourceSpec) (*unstructured.Unstructured, error)

GetUnstrResource converts ResourceSpec object to type Unstructured

func (*GenerateController) ProcessUR

type GenerateResponse added in v1.8.0

type GenerateResponse struct {
	Data                                          map[string]interface{}
	Action                                        ResourceMode
	GenKind, GenName, GenNamespace, GenAPIVersion string
	Error                                         error
}

type Handler

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

func NewHandler

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

func (Handler) Handle

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

type ResourceMode

type ResourceMode string

ResourceMode defines the mode for generated resource

Jump to

Keyboard shortcuts

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