Documentation ¶
Overview ¶
Package composition contains validation logic for the Composition type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBaseObject ¶
func GetBaseObject(ct *v1.ComposedTemplate) (client.Object, error)
GetBaseObject returns the base object of the composed template. Uses the cached object if it is available, or parses the raw Base otherwise. The returned object is a deep copy.
func IsValidInputForTransform ¶
func IsValidInputForTransform(t *v1.Transform, fromType v1.TransformIOType) error
IsValidInputForTransform validates the supplied Transform type, taking into consideration also the input type.
Types ¶
type CRDGetter ¶
type CRDGetter interface { Get(ctx context.Context, gvk schema.GroupKind) (*apiextensions.CustomResourceDefinition, error) GetAll(ctx context.Context) (map[schema.GroupKind]apiextensions.CustomResourceDefinition, error) }
CRDGetter is used to get all CRDs the Validator needs, either one by one or all at once.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates the provided Composition.
func NewValidator ¶
func NewValidator(opts ...ValidatorOption) (*Validator, error)
NewValidator returns a new Validator starting with the default configuration and applying the given options.
type ValidatorOption ¶
type ValidatorOption func(*Validator)
ValidatorOption is used to configure the Validator.
func WithCRDGetter ¶
func WithCRDGetter(c CRDGetter) ValidatorOption
WithCRDGetter returns a ValidatorOption that configure the validator to use the given CRDGetter to retrieve the CRD it needs.
func WithCRDGetterFromMap ¶
func WithCRDGetterFromMap(m map[schema.GroupKind]apiextensions.CustomResourceDefinition) ValidatorOption
WithCRDGetterFromMap returns a ValidatorOption that configure the Validator to use the given map as a CRDGetter. Will return an error if the CRD is not found on calls to Get.
func WithLogicalValidation ¶
func WithLogicalValidation() ValidatorOption
WithLogicalValidation returns a ValidatorOption that configures the Validator to use the given function to logically validate the Composition.
func WithoutLogicalValidation ¶
func WithoutLogicalValidation() ValidatorOption
WithoutLogicalValidation returns a ValidatorOption that configures the Validator to not perform any logical check on the Composition.