Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterValidatingHandler ¶
func RegisterValidatingHandler(mgr manager.Manager, _ 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 ¶
func (fn TraitDefValidatorFn) Validate(ctx context.Context, td v1beta1.TraitDefinition) error
Validate implements TraitDefValidator method
type ValidatingHandler ¶
type ValidatingHandler struct { Client client.Client // Decoder decodes object Decoder *admission.Decoder // Validators validate objects Validators []TraitDefValidator }
ValidatingHandler handles validation of 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