Documentation
¶
Index ¶
- Variables
- func ValidateEachObject(ctx context.Context, manifest *manifests.PackageManifest, ...) error
- type LockfileConsistencyValidator
- type LockfileDigestLookupValidator
- type ObjectDuplicateValidator
- type ObjectGVKValidator
- type ObjectLabelsValidator
- type ObjectPhaseAnnotationValidator
- type ObjectValidatorList
- type PackageManifestValidator
- type PackageScopeValidator
- type PackageStaticFilesWithoutTestCasesValidator
- type PackageValidatorList
- type TemplateTestValidator
- type ValidateEachObjectFn
Constants ¶
This section is empty.
Variables ¶
var DefaultObjectValidators = ObjectValidatorList{ &ObjectDuplicateValidator{}, &ObjectGVKValidator{}, &ObjectLabelsValidator{}, &ObjectPhaseAnnotationValidator{}, }
DefaultObjectValidators is a list of object validators that should be executed as a minimum standard.
var DefaultPackageValidators = PackageValidatorList{ &PackageManifestValidator{ validatePackageManifest: packagemanifestvalidation.ValidatePackageManifest, validatePackageManifestLock: packagemanifestvalidation.ValidatePackageManifestLock, }, &LockfileConsistencyValidator{}, &PackageStaticFilesWithoutTestCasesValidator{}, }
DefaultPackageValidators is a list of package validators that should be executed as a minimum standard.
Functions ¶
func ValidateEachObject ¶
func ValidateEachObject( ctx context.Context, manifest *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, validate ValidateEachObjectFn, ) error
ValidateEachObject iterates over each object in a package and runs the given validation function.
Types ¶
type LockfileConsistencyValidator ¶ added in v1.10.0
type LockfileConsistencyValidator struct{}
Validates that the PackageManifestLock is consistent with PackageManifest.
func (*LockfileConsistencyValidator) ValidatePackage ¶ added in v1.10.0
func (v *LockfileConsistencyValidator) ValidatePackage( _ context.Context, pkg *packagetypes.Package, ) error
type LockfileDigestLookupValidator ¶ added in v1.10.0
type LockfileDigestLookupValidator struct { // Options passed to crane when looking up the digest. CraneOptions []crane.Option // contains filtered or unexported fields }
Validates that images referenced in the lockfile are still present in the registry.
func (*LockfileDigestLookupValidator) ValidatePackage ¶ added in v1.10.0
func (v *LockfileDigestLookupValidator) ValidatePackage( _ context.Context, pkg *packagetypes.Package, ) error
type ObjectDuplicateValidator ¶
type ObjectDuplicateValidator struct{}
Validates that Objects with the same name/namespace/kind/group must only exist once over all phases. APIVersion does not matter for the check.
func (*ObjectDuplicateValidator) ValidateObjects ¶
func (v *ObjectDuplicateValidator) ValidateObjects( _ context.Context, _ *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, ) error
type ObjectGVKValidator ¶
type ObjectGVKValidator struct{}
Validates that every object has Group, Version and Kind set. e.g. apiVersion: and kind:.
func (*ObjectGVKValidator) ValidateObjects ¶
func (v *ObjectGVKValidator) ValidateObjects( ctx context.Context, manifest *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, ) error
type ObjectLabelsValidator ¶
type ObjectLabelsValidator struct{}
Validates that all labels are valid.
func (*ObjectLabelsValidator) ValidateObjects ¶
func (v *ObjectLabelsValidator) ValidateObjects( ctx context.Context, manifest *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, ) error
type ObjectPhaseAnnotationValidator ¶
type ObjectPhaseAnnotationValidator struct{}
Validates that the PKO phase-annotation is set on all objects.
func (*ObjectPhaseAnnotationValidator) ValidateObjects ¶
func (v *ObjectPhaseAnnotationValidator) ValidateObjects( ctx context.Context, manifest *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, ) error
type ObjectValidatorList ¶
type ObjectValidatorList []packagetypes.ObjectValidator
ObjectValidatorList runs a list of validators and joins all errors.
func (ObjectValidatorList) ValidateObjects ¶
func (l ObjectValidatorList) ValidateObjects( ctx context.Context, manifest *manifests.PackageManifest, objects map[string][]unstructured.Unstructured, ) error
type PackageManifestValidator ¶
type PackageManifestValidator struct {
// contains filtered or unexported fields
}
Validates PackageManifests and PackageManifestLock.
func (*PackageManifestValidator) ValidatePackage ¶
func (v *PackageManifestValidator) ValidatePackage(ctx context.Context, pkg *packagetypes.Package) error
type PackageScopeValidator ¶
type PackageScopeValidator manifests.PackageManifestScope
Validates a Package is able to be installed in the given scope.
func (PackageScopeValidator) ValidatePackage ¶
func (scope PackageScopeValidator) ValidatePackage(_ context.Context, pkg *packagetypes.Package) error
type PackageStaticFilesWithoutTestCasesValidator ¶ added in v1.12.0
type PackageStaticFilesWithoutTestCasesValidator struct{}
Validates static files if no test-cases are defined.
func (PackageStaticFilesWithoutTestCasesValidator) ValidatePackage ¶ added in v1.12.0
func (v PackageStaticFilesWithoutTestCasesValidator) ValidatePackage( ctx context.Context, pkg *packagetypes.Package, ) error
type PackageValidatorList ¶
type PackageValidatorList []packagetypes.PackageValidator
PackageValidatorList runs a list of validators and joins all errors.
func (PackageValidatorList) ValidatePackage ¶
func (l PackageValidatorList) ValidatePackage(ctx context.Context, pkg *packagetypes.Package) error
type TemplateTestValidator ¶
type TemplateTestValidator struct {
// contains filtered or unexported fields
}
Runs the template test suites.
func NewTemplateTestValidator ¶
func NewTemplateTestValidator( packageBaseFolderPath string, ) *TemplateTestValidator
Creates a new TemplateTestValidator instance.
func (TemplateTestValidator) ValidatePackage ¶
func (v TemplateTestValidator) ValidatePackage( ctx context.Context, pkg *packagetypes.Package, ) error
type ValidateEachObjectFn ¶
type ValidateEachObjectFn func( ctx context.Context, path string, index int, obj unstructured.Unstructured, manifest *manifests.PackageManifest, ) error
Function given to ValidateEachObject to validate individual objects in a package.