xpkg

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetaFile is the name of a Crossplane package metadata file.
	MetaFile string = "crossplane.yaml"

	// StreamFile is the name of the file in a Crossplane package image that
	// contains its YAML stream.
	StreamFile string = "package.yaml"

	// StreamFileMode determines the permissions on the stream file.
	StreamFileMode os.FileMode = 0o644

	// XpkgExtension is the extension for compiled Crossplane packages.
	XpkgExtension string = ".xpkg"

	// XpkgMatchPattern is the match pattern for identifying compiled Crossplane packages.
	XpkgMatchPattern string = "*" + XpkgExtension
)

Variables

This section is empty.

Functions

func Build

Build compiles a Crossplane package from an on-disk package.

func BuildMetaScheme

func BuildMetaScheme() (*runtime.Scheme, error)

BuildMetaScheme builds the default scheme used for identifying metadata in a Crossplane package.

func BuildObjectScheme

func BuildObjectScheme() (*runtime.Scheme, error)

BuildObjectScheme builds the default scheme used for identifying objects in a Crossplane package.

func BuildPath

func BuildPath(path, name string) string

BuildPath builds a path for a compiled Crossplane package. If file name has extension it will be replaced.

func FindXpkgInDir

func FindXpkgInDir(fs afero.Fs, root string) (string, error)

FindXpkgInDir finds compiled Crossplane packages in a directory.

func FriendlyID

func FriendlyID(name, hash string) string

FriendlyID builds a valid DNS label string made up of the name of a package and its image digest.

func IsCRD

func IsCRD(o runtime.Object) error

IsCRD checks that an object is a CustomResourceDefinition.

func IsComposition

func IsComposition(o runtime.Object) error

IsComposition checks that an object is a Composition.

func IsConfiguration

func IsConfiguration(o runtime.Object) error

IsConfiguration checks that an object is a Configuration meta type.

func IsProvider

func IsProvider(o runtime.Object) error

IsProvider checks that an object is a Provider meta type.

func IsXRD

func IsXRD(o runtime.Object) error

IsXRD checks that an object is a CompositeResourceDefinition.

func NewConfigurationLinter

func NewConfigurationLinter() parser.Linter

NewConfigurationLinter is a convenience function for creating a package linter for configurations.

func NewProviderLinter

func NewProviderLinter() parser.Linter

NewProviderLinter is a convenience function for creating a package linter for providers.

func OneMeta

func OneMeta(pkg *parser.Package) error

OneMeta checks that there is only one meta object in the package.

func PackageCrossplaneCompatible

func PackageCrossplaneCompatible(v version.Operations) parser.ObjectLinterFn

PackageCrossplaneCompatible checks that the current Crossplane version is compatible with the package constraints.

func PackageValidSemver

func PackageValidSemver(o runtime.Object) error

PackageValidSemver checks that the package uses valid semver ranges.

func ParseNameFromMeta

func ParseNameFromMeta(fs afero.Fs, path string) (string, error)

ParseNameFromMeta extracts the package name from its meta file.

func ToDNSLabel

func ToDNSLabel(s string) string

ToDNSLabel converts the string to a valid DNS label.

func TryConvert

func TryConvert(obj runtime.Object, candidates ...conversion.Hub) (runtime.Object, bool)

TryConvert converts the supplied object to the first supplied candidate that does not return an error. Returns the converted object and true when conversion succeeds, or the original object and false if it does not.

func TryConvertToPkg

func TryConvertToPkg(obj runtime.Object, candidates ...conversion.Hub) (pkgmetav1.Pkg, bool)

TryConvertToPkg converts the supplied object to a pkgmeta.Pkg, if possible.

Types

type Cache

type Cache interface {
	Get(tag string, id string) (v1.Image, error)
	Store(tag string, id string, img v1.Image) error
	Delete(id string) error
}

A Cache caches OCI images.

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
	Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)
	Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)
}

Fetcher fetches package images.

type ImageCache

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

ImageCache stores and retrieves OCI images in a filesystem-backed cache in a thread-safe manner.

func NewImageCache

func NewImageCache(dir string, fs afero.Fs) *ImageCache

NewImageCache creates a new ImageCache.

func (*ImageCache) Delete

func (c *ImageCache) Delete(id string) error

Delete removes an image from the ImageCache.

func (*ImageCache) Get

func (c *ImageCache) Get(tag, id string) (v1.Image, error)

Get retrieves an image from the ImageCache.

func (*ImageCache) Store

func (c *ImageCache) Store(tag, id string, img v1.Image) error

Store saves an image to the ImageCache.

type K8sFetcher

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

K8sFetcher uses kubernetes credentials to fetch package images.

func NewK8sFetcher

func NewK8sFetcher(client kubernetes.Interface, namespace string) *K8sFetcher

NewK8sFetcher creates a new K8sFetcher.

func (*K8sFetcher) Fetch

func (i *K8sFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)

Fetch fetches a package image.

func (*K8sFetcher) Head

func (i *K8sFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)

Head fetches a package descriptor.

func (*K8sFetcher) Tags

func (i *K8sFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)

Tags fetches a package's tags.

type NopCache

type NopCache struct{}

NopCache is a cache implementation that does not store anything and always returns an error on get.

func NewNopCache

func NewNopCache() *NopCache

NewNopCache creates a new NopCache.

func (*NopCache) Delete

func (c *NopCache) Delete(id string) error

Delete removes an image from the NopCache.

func (*NopCache) Get

func (c *NopCache) Get(tag, id string) (v1.Image, error)

Get retrieves an image from the NopCache.

func (*NopCache) Store

func (c *NopCache) Store(tag, id string, img v1.Image) error

Store saves an image to the NopCache.

type NopFetcher

type NopFetcher struct{}

NopFetcher always returns an empty image and never returns error.

func NewNopFetcher

func NewNopFetcher() *NopFetcher

NewNopFetcher creates a new NopFetcher.

func (*NopFetcher) Fetch

func (n *NopFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)

Fetch fetches an empty image and does not return error.

func (*NopFetcher) Head

func (n *NopFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)

Head returns a nil descriptor and does not return error.

func (*NopFetcher) Tags

func (n *NopFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)

Tags returns a nil slice and does not return error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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