packageloader

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 22 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 CommonObjectLabelsTransformer

type CommonObjectLabelsTransformer struct{ Package metav1.Object }

func (CommonObjectLabelsTransformer) TransformPackage

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

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 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 PackageScopeValidator

type PackageScopeValidator manifestsv1alpha1.PackageManifestScope

func (PackageScopeValidator) ValidatePackage

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

type TemplateContext

type TemplateContext struct {
	Package manifestsv1alpha1.TemplateContextPackage `json:"package"`
	Config  map[string]interface{}                   `json:"config"`
}

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 TemplateTransformer

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

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

func NewTemplateTransformer

func NewTemplateTransformer(tmplCtx TemplateContext) (*TemplateTransformer, error)

func (*TemplateTransformer) TransformPackageFiles

func (t *TemplateTransformer) TransformPackageFiles(ctx context.Context, 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