packageloader

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicateConfig = errors.New("config raw and object fields are both set")

Functions

func TransformEachObject

func TransformEachObject(ctx context.Context, packageContent *packagecontent.Package, transform TransformEachObjectFn) error

func ValidateEachObject

func ValidateEachObject(ctx context.Context, pkg *packagecontent.Package, validate ValidateEachObjectFn) error

func WithDefaults

func WithDefaults(l *Loader)

Types

type FilesTransformer

type FilesTransformer interface {
	TransformPackageFiles(ctx context.Context, files packagecontent.Files) error
}

type Loader

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

func New

func New(scheme *runtime.Scheme, opts ...Option) *Loader

func (Loader) FromFiles

func (l Loader) FromFiles(ctx context.Context, files packagecontent.Files, opts ...Option) (*packagecontent.Package, error)

This modifies input file set.

type ObjectDuplicateValidator added in v1.7.0

type ObjectDuplicateValidator struct{}

func (*ObjectDuplicateValidator) ValidatePackage added in v1.7.0

func (v *ObjectDuplicateValidator) ValidatePackage(_ context.Context, packageContent *packagecontent.Package) error

Objects with the same name/namespace/kind/group must only exist once over all phases. APIVersion does not matter for the check.

type ObjectGVKValidator

type ObjectGVKValidator struct{}

func (*ObjectGVKValidator) ValidatePackage

func (v *ObjectGVKValidator) ValidatePackage(ctx context.Context, packageContent *packagecontent.Package) error

type ObjectLabelsValidator

type ObjectLabelsValidator struct{}

func (*ObjectLabelsValidator) ValidatePackage

func (v *ObjectLabelsValidator) ValidatePackage(ctx context.Context, packageContent *packagecontent.Package) error

type ObjectPhaseAnnotationValidator

type ObjectPhaseAnnotationValidator struct{}

func (*ObjectPhaseAnnotationValidator) ValidatePackage

func (v *ObjectPhaseAnnotationValidator) ValidatePackage(ctx context.Context, packageContent *packagecontent.Package) error

type Option

type Option func(l *Loader)

func WithFilesTransformers

func WithFilesTransformers(transformers ...FilesTransformer) Option

func WithPackageAndFilesValidators

func WithPackageAndFilesValidators(validators ...PackageAndFilesValidator) Option

func WithTransformers

func WithTransformers(transformers ...Transformer) Option

func WithValidators

func WithValidators(validators ...Validator) Option

type PackageAndFilesValidator

type PackageAndFilesValidator interface {
	ValidatePackageAndFiles(ctx context.Context, pkg *packagecontent.Package, files packagecontent.Files) error
}

type PackageFileTemplateContext added in v1.4.0

type PackageFileTemplateContext struct {
	Package     manifestsv1alpha1.TemplateContextPackage `json:"package"`
	Config      map[string]interface{}                   `json:"config"`
	Images      map[string]string                        `json:"images"`
	Environment manifestsv1alpha1.PackageEnvironment     `json:"environment"`
}

type PackageFileTemplateTransformer added in v1.4.0

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

Runs a go-template transformer on all .yml or .yaml files.

func (*PackageFileTemplateTransformer) TransformPackageFiles added in v1.4.0

func (t *PackageFileTemplateTransformer) TransformPackageFiles(ctx context.Context, fileMap packagecontent.Files) error

type PackageScopeValidator

type PackageScopeValidator manifestsv1alpha1.PackageManifestScope

func (PackageScopeValidator) ValidatePackage

func (scope PackageScopeValidator) ValidatePackage(_ context.Context, packageContent *packagecontent.Package) error

type PackageTransformer added in v1.4.0

type PackageTransformer struct{ Package metav1.Object }

func (*PackageTransformer) TransformPackage added in v1.4.0

func (t *PackageTransformer) TransformPackage(ctx context.Context, packageContent *packagecontent.Package) error

type TemplateTestValidator

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

func NewTemplateTestValidator

func NewTemplateTestValidator(
	scheme *runtime.Scheme, fixturesFolderPath string,
) *TemplateTestValidator

func (TemplateTestValidator) ValidatePackageAndFiles

func (v TemplateTestValidator) ValidatePackageAndFiles(
	ctx context.Context, pkg *packagecontent.Package, fileMap packagecontent.Files,
) error

type TransformEachObjectFn

type TransformEachObjectFn func(
	ctx context.Context, path string, index int, packageManifest *manifestsv1alpha1.PackageManifest, obj *unstructured.Unstructured) error

type Transformer

type Transformer interface {
	TransformPackage(ctx context.Context, pkg *packagecontent.Package) error
}

type ValidateEachObjectFn

type ValidateEachObjectFn func(ctx context.Context, path string, index int, obj unstructured.Unstructured) error

type Validator

type Validator interface {
	ValidatePackage(ctx context.Context, pkg *packagecontent.Package) error
}

type ValidatorList

type ValidatorList []Validator

Runs a list of Validator over the given content.

func (ValidatorList) ValidatePackage

func (l ValidatorList) ValidatePackage(ctx context.Context, pkg *packagecontent.Package) error

Jump to

Keyboard shortcuts

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