traitdefinition

package
v0.0.0-...-2c539bb Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidatingHandler

func RegisterValidatingHandler(mgr manager.Manager, args controller.Args)

RegisterValidatingHandler will register TraitDefinition validation to webhook

func ValidateDefinitionReference

func ValidateDefinitionReference(_ context.Context, td v1beta1.TraitDefinition) error

ValidateDefinitionReference validates whether the trait definition is valid if its `.spec.reference` field is unset. It's valid if it has at least one output, and all outputs must have GVK or it has no output but has a patch or it has a patch and outputs, and all outputs must have GVK TODO(roywang) currently we only validate whether it contains CUE template. Further validation, e.g., output with GVK, valid patch, etc, remains to be done.

Types

type TraitDefValidator

type TraitDefValidator interface {
	Validate(context.Context, v1beta1.TraitDefinition) error
}

TraitDefValidator validate trait definition

type TraitDefValidatorFn

type TraitDefValidatorFn func(context.Context, v1beta1.TraitDefinition) error

TraitDefValidatorFn implements TraitDefValidator

func (TraitDefValidatorFn) Validate

Validate implements TraitDefValidator method

type ValidatingHandler

type ValidatingHandler struct {
	Client client.Client
	Mapper discoverymapper.DiscoveryMapper

	// Decoder decodes object
	Decoder *admission.Decoder
	// Validators validate objects
	Validators []TraitDefValidator
}

ValidatingHandler handles validation of trait definition

func (*ValidatingHandler) Handle

Handle validate trait definition

func (*ValidatingHandler) InjectClient

func (h *ValidatingHandler) InjectClient(c client.Client) error

InjectClient injects the client into the ValidatingHandler

func (*ValidatingHandler) InjectDecoder

func (h *ValidatingHandler) InjectDecoder(d *admission.Decoder) error

InjectDecoder injects the decoder into the ValidatingHandler

Jump to

Keyboard shortcuts

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