Documentation
¶
Overview ¶
Package validate implements offline schema validation of Crossplane resources.
Index ¶
- func IsErrBaseLayerNotFound(err error) bool
- func NewBaseLayerNotFoundError(image string) error
- func SchemaValidation(resources []*unstructured.Unstructured, crds []*extv1.CustomResourceDefinition, ...) error
- type BaseLayerNotFoundError
- type Cache
- type Cmd
- type Fetcher
- type FileLoader
- type FolderLoader
- type ImageFetcher
- type Loader
- type LocalCache
- type Manager
- type Option
- type StdinLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrBaseLayerNotFound ¶ added in v1.18.0
IsErrBaseLayerNotFound checks if the error is of type BaseLayerNotFoundError.
func NewBaseLayerNotFoundError ¶ added in v1.18.0
NewBaseLayerNotFoundError returns a new BaseLayerNotFoundError error.
func SchemaValidation ¶
func SchemaValidation(resources []*unstructured.Unstructured, crds []*extv1.CustomResourceDefinition, skipSuccessLogs bool, w io.Writer) error
SchemaValidation validates the resources against the given CRDs.
Types ¶
type BaseLayerNotFoundError ¶ added in v1.18.0
type BaseLayerNotFoundError struct {
// contains filtered or unexported fields
}
BaseLayerNotFoundError is returned when the base layer of the image could not be found.
func (*BaseLayerNotFoundError) Error ¶ added in v1.18.0
func (e *BaseLayerNotFoundError) Error() string
Error implements the error interface.
type Cache ¶
type Cache interface { Store(schemas [][]byte, path string) error Flush() error Init() error Load() ([]*unstructured.Unstructured, error) Exists(image string) (string, error) }
Cache defines an interface for caching schemas.
type Cmd ¶
type Cmd struct { // Arguments. Extensions string `arg:"" help:"Extensions source which can be a file, directory, or '-' for standard input."` Resources string `arg:"" help:"Resources source which can be a file, directory, or '-' for standard input."` // Flags. Keep them in alphabetical order. CacheDir string `` /* 164-byte string literal not displayed */ CleanCache bool `help:"Clean the cache directory before downloading package schemas."` SkipSuccessResults bool `help:"Skip printing success results."` CrossplaneImage string `help:"Specify the Crossplane image to be used for validating the built-in schemas."` // contains filtered or unexported fields }
Cmd arguments and flags for render subcommand.
type Fetcher ¶
type Fetcher struct{}
Fetcher implements the ImageFetcher interface.
func (*Fetcher) FetchBaseLayer ¶
FetchBaseLayer fetches the base layer of the image which contains the 'package.yaml' file.
type FileLoader ¶
type FileLoader struct {
// contains filtered or unexported fields
}
FileLoader implements the Loader interface for reading from a file and converting input to unstructured objects.
func (*FileLoader) Load ¶
func (f *FileLoader) Load() ([]*unstructured.Unstructured, error)
Load reads the contents from a file.
type FolderLoader ¶
type FolderLoader struct {
// contains filtered or unexported fields
}
FolderLoader implements the Loader interface for reading from a folder.
func (*FolderLoader) Load ¶
func (f *FolderLoader) Load() ([]*unstructured.Unstructured, error)
Load reads the contents from all files in a folder.
type ImageFetcher ¶
type ImageFetcher interface { FetchBaseLayer(image string) (*conregv1.Layer, error) FetchImage(image string) ([]conregv1.Layer, error) }
ImageFetcher defines an interface for fetching images.
type Loader ¶
type Loader interface {
Load() ([]*unstructured.Unstructured, error)
}
Loader interface defines the contract for different input sources.
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
LocalCache implements the Cache interface.
func (*LocalCache) Exists ¶
func (c *LocalCache) Exists(image string) (string, error)
Exists checks if the cache contains the image and returns the path if it doesn't exist.
func (*LocalCache) Init ¶
func (c *LocalCache) Init() error
Init creates the cache directory if it doesn't exist.
func (*LocalCache) Load ¶
func (c *LocalCache) Load() ([]*unstructured.Unstructured, error)
Load loads the schemas from the cache directory.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager defines a Manager for preparing Crossplane packages for validation.
func NewManager ¶
NewManager returns a new Manager.
func (*Manager) CacheAndLoad ¶
CacheAndLoad finds and caches dependencies and loads them as CRDs.
func (*Manager) PrepExtensions ¶
func (m *Manager) PrepExtensions(extensions []*unstructured.Unstructured) error
PrepExtensions converts the unstructured XRDs/CRDs to CRDs and extract package images to add as a dependency.
type Option ¶ added in v1.18.0
type Option func(*Manager)
Option defines an option for the Manager.
func WithCrossplaneImage ¶ added in v1.18.0
WithCrossplaneImage sets the Crossplane image to use for fetching CRDs.
type StdinLoader ¶
type StdinLoader struct{}
StdinLoader implements the Loader interface for reading from stdin.
func (*StdinLoader) Load ¶
func (s *StdinLoader) Load() ([]*unstructured.Unstructured, error)
Load reads the contents from stdin.