Documentation ¶
Overview ¶
Package xpkg contains functionality pertaining to Crossplane packages.
Index ¶
- Constants
- func AnnotateLayers(i v1.Image) (v1.Image, error)
- func BuildMetaScheme() (*runtime.Scheme, error)
- func BuildObjectScheme() (*runtime.Scheme, error)
- func BuildPath(path, name, ext string) string
- func FindXpkgInDir(fs afero.Fs, root string) (string, error)
- func FriendlyID(name, hash string) string
- func GzipReadCloser(rc io.ReadCloser) (io.ReadCloser, error)
- func IsCRD(o runtime.Object) error
- func IsComposition(o runtime.Object) error
- func IsConfiguration(o runtime.Object) error
- func IsFunction(o runtime.Object) error
- func IsMutatingWebhookConfiguration(o runtime.Object) error
- func IsProvider(o runtime.Object) error
- func IsValidatingWebhookConfiguration(o runtime.Object) error
- func IsXRD(o runtime.Object) error
- func JoinedReadCloser(r io.Reader, c io.Closer) io.ReadCloser
- func Label(annotation string) string
- func Layer(r io.Reader, fileName, annotation string, fileSize int64, mode os.FileMode, ...) (v1.Layer, error)
- func NewConfigurationLinter() parser.Linter
- func NewFunctionLinter() parser.Linter
- func NewProviderLinter() parser.Linter
- func OneMeta(pkg parser.Lintable) error
- func PackageCrossplaneCompatible(v version.Operations) parser.ObjectLinterFn
- func PackageValidSemver(o runtime.Object) error
- func ParseNameFromMeta(fs afero.Fs, path string) (string, error)
- func ParsePackageSourceFromReference(ref name.Reference) string
- func SkipContains(pattern string) parser.FilterFn
- func TeeReadCloser(r io.ReadCloser, w io.WriteCloser) io.ReadCloser
- func ToDNSLabel(s string) string
- func TryConvert(obj runtime.Object, candidates ...conversion.Hub) (runtime.Object, bool)
- func TryConvertToPkg(obj runtime.Object, candidates ...conversion.Hub) (pkgmetav1.Pkg, bool)
- type BuildOpt
- type Builder
- type Fetcher
- type FetcherOpt
- type FsPackageCache
- type K8sFetcher
- func (i *K8sFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
- func (i *K8sFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)
- func (i *K8sFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)
- type NopCache
- type NopFetcher
- type PackageCache
Constants ¶
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 // XpkgExamplesFile is the name of the file in a Crossplane package image // that contains the examples YAML stream. XpkgExamplesFile string = ".up/examples.yaml" // AnnotationKey is the key value for xpkg annotations. AnnotationKey string = "io.crossplane.xpkg" // PackageAnnotation is the annotation value used for the package.yaml // layer. PackageAnnotation string = "base" // ExamplesAnnotation is the annotation value used for the examples.yaml // layer. // TODO(lsviben) Consider changing this to "examples". ExamplesAnnotation string = "upbound" // DefaultRegistry is the registry name that will be used when no registry // is provided. DefaultRegistry string = "xpkg.upbound.io" )
Variables ¶
This section is empty.
Functions ¶
func AnnotateLayers ¶ added in v1.14.0
AnnotateLayers propagates labels from the supplied image's config file to annotations on its layers.
func BuildMetaScheme ¶
BuildMetaScheme builds the default scheme used for identifying metadata in a Crossplane package.
func BuildObjectScheme ¶
BuildObjectScheme builds the default scheme used for identifying objects in a Crossplane package.
func FindXpkgInDir ¶
FindXpkgInDir finds compiled Crossplane packages in a directory.
func FriendlyID ¶
FriendlyID builds a valid DNS label string made up of the name of a package and its image digest.
func GzipReadCloser ¶ added in v1.7.0
func GzipReadCloser(rc io.ReadCloser) (io.ReadCloser, error)
GzipReadCloser constructs a new gzipReadCloser from the passed file.
func IsComposition ¶
IsComposition checks that an object is a Composition.
func IsConfiguration ¶
IsConfiguration checks that an object is a Configuration meta type.
func IsFunction ¶ added in v1.13.0
IsFunction checks that an object is a Function meta type.
func IsMutatingWebhookConfiguration ¶ added in v1.5.3
IsMutatingWebhookConfiguration checks that an object is a MutatingWebhookConfiguration.
func IsProvider ¶
IsProvider checks that an object is a Provider meta type.
func IsValidatingWebhookConfiguration ¶ added in v1.5.3
IsValidatingWebhookConfiguration checks that an object is a ValidatingWebhookConfiguration.
func JoinedReadCloser ¶ added in v1.7.0
JoinedReadCloser constructs a new joinedReadCloser from the passed reader and closer.
func Layer ¶ added in v1.14.0
func Layer(r io.Reader, fileName, annotation string, fileSize int64, mode os.FileMode, cfg *v1.Config) (v1.Layer, error)
Layer creates a v1.Layer that represents the layer contents for the xpkg and adds a corresponding label to the image Config for the layer.
func NewConfigurationLinter ¶
NewConfigurationLinter is a convenience function for creating a package linter for configurations.
func NewFunctionLinter ¶ added in v1.13.0
NewFunctionLinter is a convenience function for creating a package linter for functions.
func NewProviderLinter ¶
NewProviderLinter is a convenience function for creating a package linter for providers.
func PackageCrossplaneCompatible ¶
func PackageCrossplaneCompatible(v version.Operations) parser.ObjectLinterFn
PackageCrossplaneCompatible checks that the current Crossplane version is compatible with the package constraints.
func PackageValidSemver ¶
PackageValidSemver checks that the package uses valid semver ranges.
func ParseNameFromMeta ¶
ParseNameFromMeta extracts the package name from its meta file.
func ParsePackageSourceFromReference ¶ added in v1.4.0
ParsePackageSourceFromReference parses a package source from an OCI image reference. A source is defined as an OCI image reference with the identifier (tag or digest) stripped and no other changes to the original reference source. This is necessary because go-containerregistry will convert docker.io to index.docker.io for backwards compatibility before pulling an image. We do not want to do that in cases where we are not pulling an image because it breaks comparison with dependencies defined in a Configuration manifest.
func SkipContains ¶ added in v1.14.0
SkipContains supplies a FilterFn that skips paths that contain the give pattern.
func TeeReadCloser ¶ added in v1.7.0
func TeeReadCloser(r io.ReadCloser, w io.WriteCloser) io.ReadCloser
TeeReadCloser constructs a teeReadCloser from the passed reader and writer.
func ToDNSLabel ¶
ToDNSLabel converts the string to a valid DNS label.
func TryConvert ¶
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 ¶
TryConvertToPkg converts the supplied object to a pkgmeta.Pkg, if possible.
Types ¶
type BuildOpt ¶ added in v1.14.0
type BuildOpt func(*buildOpts)
A BuildOpt modifies how a package is built.
type Builder ¶ added in v1.14.0
type Builder struct {
// contains filtered or unexported fields
}
Builder defines an xpkg Builder.
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 FetcherOpt ¶ added in v1.6.0
type FetcherOpt func(k *K8sFetcher) error
FetcherOpt can be used to add optional parameters to NewK8sFetcher.
func WithCustomCA ¶ added in v1.6.0
func WithCustomCA(rootCAs *x509.CertPool) FetcherOpt
WithCustomCA is a FetcherOpt that can be used to add a custom CA bundle to a K8sFetcher.
func WithNamespace ¶ added in v1.10.0
func WithNamespace(ns string) FetcherOpt
WithNamespace is a FetcherOpt that sets the Namespace for fetching package pull secrets.
func WithServiceAccount ¶ added in v1.10.0
func WithServiceAccount(sa string) FetcherOpt
WithServiceAccount is a FetcherOpt that sets the ServiceAccount name for fetching package pull secrets.
func WithUserAgent ¶ added in v1.11.0
func WithUserAgent(userAgent string) FetcherOpt
WithUserAgent is a FetcherOpt that can be used to set the user agent on all HTTP requests.
type FsPackageCache ¶ added in v1.7.0
type FsPackageCache struct {
// contains filtered or unexported fields
}
FsPackageCache stores and retrieves package content in a filesystem-backed cache in a thread-safe manner.
func NewFsPackageCache ¶ added in v1.7.0
func NewFsPackageCache(dir string, fs afero.Fs) *FsPackageCache
NewFsPackageCache creates a new FsPackageCache.
func (*FsPackageCache) Delete ¶ added in v1.7.0
func (c *FsPackageCache) Delete(id string) error
Delete removes package contents from the cache.
func (*FsPackageCache) Get ¶ added in v1.7.0
func (c *FsPackageCache) Get(id string) (io.ReadCloser, error)
Get retrieves package contents from the cache.
func (*FsPackageCache) Has ¶ added in v1.7.0
func (c *FsPackageCache) Has(id string) bool
Has indicates whether an item with the given id is in the cache.
func (*FsPackageCache) Store ¶ added in v1.7.0
func (c *FsPackageCache) Store(id string, content io.ReadCloser) error
Store saves the package contents to the cache.
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, opts ...FetcherOpt) (*K8sFetcher, error)
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.
type NopCache ¶
type NopCache struct{}
NopCache is a cache implementation that does not store anything and always returns an error on get.
func (*NopCache) Get ¶
func (c *NopCache) Get(string) (io.ReadCloser, error)
Get retrieves content from the NopCache.
type NopFetcher ¶
type NopFetcher struct{}
NopFetcher always returns an empty image and never returns error.
type PackageCache ¶ added in v1.7.0
type PackageCache interface { Has(id string) bool Get(id string) (io.ReadCloser, error) Store(id string, content io.ReadCloser) error Delete(id string) error }
A PackageCache caches package content.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fake contains mock Crossplane package implementations.
|
Package fake contains mock Crossplane package implementations. |
parser
|
|
examples
Package examples contains utilities for parsing examples.
|
Package examples contains utilities for parsing examples. |
yaml
Package yaml contains utilities for reading yaml packages.
|
Package yaml contains utilities for reading yaml packages. |
Package upbound implements authentication for xpkg.upbound.io.
|
Package upbound implements authentication for xpkg.upbound.io. |
config
Package config manages the Crossplane CLI configuration.
|
Package config manages the Crossplane CLI configuration. |
credhelper
Package credhelper provides a docker credential helper for the Upbound marketplace.
|
Package credhelper provides a docker credential helper for the Upbound marketplace. |