Documentation
¶
Overview ¶
Package xpkg contains CLI-specific functionality for working with Crossplane packages.
Index ¶
- func CRDFilesystem(pkg *parser.Package) (afero.Fs, error)
- func NewClient(fetcher xpkg.Fetcher, opts ...ClientOption) (xpkg.Client, error)
- func NewStaticImageConfigStore(imageConfigs []pkgv1beta1.ImageConfig) xpkg.ConfigStore
- type ClientOption
- type RemoteFetcher
- func (f *RemoteFetcher) Fetch(ctx context.Context, ref name.Reference, _ ...string) (v1.Image, error)
- func (f *RemoteFetcher) Head(ctx context.Context, ref name.Reference, _ ...string) (*v1.Descriptor, error)
- func (f *RemoteFetcher) Tags(ctx context.Context, ref name.Reference, _ ...string) ([]string, error)
- type RemoteFetcherOption
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CRDFilesystem ¶
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 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.
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 ¶
NewResolver returns a Resolver backed by client.