composition

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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 GetBaseObjectGVK added in v1.13.0

func GetBaseObjectGVK(ct *v1.ComposedTemplate) (schema.GroupVersionKind, error)

GetBaseObjectGVK returns the GroupVersionKind of the base object of the composed template.

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

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.

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, obj runtime.Object) (warns []string, errs field.ErrorList)

Validate validates the provided Composition.

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

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.

Jump to

Keyboard shortcuts

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