xpkg

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package xpkg contains CLI-specific functionality for working with Crossplane packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRDFilesystem

func CRDFilesystem(pkg *parser.Package) (afero.Fs, error)

CRDFilesystem writes each CRD object in the package to a separate YAML file in an in-memory filesystem. Files are named <plural>.<group>.yaml so the schema generator sees per-CRD inputs. Non-CRD objects in the package are skipped.

func NewClient

func NewClient(fetcher xpkg.Fetcher, opts ...ClientOption) (xpkg.Client, error)

NewClient assembles an xpkg.Client.

func NewStaticImageConfigStore

func NewStaticImageConfigStore(imageConfigs []pkgv1beta1.ImageConfig) xpkg.ConfigStore

NewStaticImageConfigStore returns an xpkg.ConfigStore that uses the given set of ImageConfigs.

Types

type ClientOption

type ClientOption func(*options)

ClientOption configures a new client.

func WithCacheDir

func WithCacheDir(fs afero.Fs, path string) ClientOption

WithCacheDir configures the cache filesystem and directory for the client. If not provided, a non-caching client will be returned.

func WithImageConfigs

func WithImageConfigs(ics []pkgv1beta1.ImageConfig) ClientOption

WithImageConfigs injects image configs for the client.

type RemoteFetcher

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

RemoteFetcher implements a local (non-Kubernetes) xpkg.Fetcher. Pull secret arguments are accepted but ignored since there is no Kubernetes API to resolve them against in the CLI context.

func NewRemoteFetcher

func NewRemoteFetcher(opts ...RemoteFetcherOption) *RemoteFetcher

NewRemoteFetcher returns a RemoteFetcher with the given options applied.

func (*RemoteFetcher) Fetch

func (f *RemoteFetcher) Fetch(ctx context.Context, ref name.Reference, _ ...string) (v1.Image, error)

Fetch retrieves a package image from the registry.

func (*RemoteFetcher) Head

func (f *RemoteFetcher) Head(ctx context.Context, ref name.Reference, _ ...string) (*v1.Descriptor, error)

Head retrieves an image descriptor, falling back to a GET if the registry rejects HEAD.

func (*RemoteFetcher) Tags

func (f *RemoteFetcher) Tags(ctx context.Context, ref name.Reference, _ ...string) ([]string, error)

Tags lists tags for a package source.

type RemoteFetcherOption

type RemoteFetcherOption func(*RemoteFetcher)

RemoteFetcherOption configures a RemoteFetcher.

func WithKeychain

func WithKeychain(k authn.Keychain) RemoteFetcherOption

WithKeychain sets the authn.Keychain used to authenticate registry requests. Defaults to authn.DefaultKeychain.

func WithTransport

func WithTransport(t http.RoundTripper) RemoteFetcherOption

WithTransport sets the http.RoundTripper used for registry requests. Defaults to remote.DefaultTransport.

func WithUserAgent

func WithUserAgent(ua string) RemoteFetcherOption

WithUserAgent sets the User-Agent header sent on registry requests.

type Resolver

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

Resolver translates a CLI-style package reference into a fully qualified OCI ref, returning the resolved semantic version or tag where applicable.

It handles four shapes:

  • pkg@digest → returned unchanged, version=""
  • pkg:<exact-tag> → returned unchanged, version=<exact-tag>
  • pkg:<constraint> → tags listed via ListVersions, highest match wins

Opaque (non-semver, non-constraint) tags are returned unchanged with version=tag.

func NewResolver

func NewResolver(client xpkg.Client) *Resolver

NewResolver returns a Resolver backed by client.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, ref string) (name.Reference, string, error)

Resolve returns the resolved reference and the exact version tag extracted from it (empty for digest refs and bare sources).

Jump to

Keyboard shortcuts

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