Documentation
¶
Overview ¶
Package pkg loads installer packages — kustomize trees containing an installer.yaml manifest, distributed as local directories, .tgz archives, or Helm OCI artifacts.
Index ¶
- Constants
- func List(ctx context.Context, repoRef string) ([]string, error)
- func Login(ctx context.Context, registry, username, password string) error
- func Logout(ctx context.Context, registry string) error
- func Pull(ctx context.Context, ref, dest string) (string, error)
- func PullToWorkDir(ctx context.Context, ref, workDir string) (string, error)
- func ResolveManifestDigest(ctx context.Context, ref string) (string, error)
- func Tag(ctx context.Context, srcRef, dstTag string) error
- type InspectResult
- type Loaded
- type PushResult
- type RenderedOCIOptions
- type RenderedOCIResult
Constants ¶
const ManifestFile = "installer.yaml"
Variables ¶
This section is empty.
Functions ¶
func List ¶
List returns the tags of repoRef. The endpoint is `/tags/list` per the OCI distribution spec; the registry decides whether catalogs are public.
func Login ¶
Login stores a credential for registry. Credentials are written to the docker-config store, so they are shared with docker, podman, and oras.
func Pull ¶
Pull resolves a package reference to a local directory ready for Load.
Supported reference formats:
- oci://registry/path/repo:tag fetched via oras-go to dest, Helm chart unpacked
- file:///abs/path local directory or .tgz file
- /abs/path or ./relative/path local directory or .tgz file
dest is the working directory the caller wants the package extracted to; for local directory references it is returned unchanged.
Most callers should use PullToWorkDir instead — it wraps Pull with an atomic-rename pattern so a failed fetch never leaves the prior <workDir>/package/ in an indeterminate state.
func PullToWorkDir ¶
PullToWorkDir fetches ref into <workDir>/package/ atomically.
The fetch is staged into a sibling temp directory inside workDir; on success, the staged tree is renamed into <workDir>/package/. Any existing <workDir>/package/ is first renamed to a sibling temp location and removed only after the swap succeeds. A failed fetch or rename leaves the prior package/ intact via rollback.
On success, <workDir>/package/installer.yaml is guaranteed to exist. Returns the absolute path to <workDir>/package/.
func ResolveManifestDigest ¶
ResolveManifestDigest resolves an OCI reference without pulling its layers.
Types ¶
type InspectResult ¶
type InspectResult struct {
ManifestDigest string
Config *api.ConfigBlob
}
InspectResult is what Inspect returns: the OCI manifest digest plus the decoded config blob.
type Loaded ¶
type Loaded struct {
// Root is the absolute path to the package's root directory (the dir that
// contains installer.yaml and the kustomize tree).
Root string
// Package is the parsed installer.yaml.
Package *api.Package
}
Loaded is a parsed package on disk: the root directory and the parsed manifest.
type PushResult ¶
type PushResult struct {
// Ref is the full reference (without the oci:// prefix) the artifact was
// pushed to, in <host>/<repo>:<tag> form.
Ref string
// ManifestDigest is the digest of the pushed manifest, in "sha256:<hex>".
ManifestDigest string
// LayerDigest is the digest of the package layer.
LayerDigest string
// LayerSize is the size of the layer in bytes.
LayerSize int64
// Files is the list of paths inside the layer, in tar order.
Files []string
}
PushResult is what Push returns about a completed push.
func Push ¶
func Push(ctx context.Context, src, ref string) (*PushResult, error)
Push publishes a package to an OCI registry as a native installer artifact.
src may be either a .tgz file produced by internal/bundle or a source directory; directories are bundled to a temp file first. ref must be of the form oci://host/repo:tag — pushing to a digest is not supported.
type RenderedOCIOptions ¶
type RenderedOCIOptions struct {
WorkDir string
Destination string
SourceReference string
SourceDigest string
Package *api.Package
Selection *api.Selection
Inputs *api.Inputs
}
RenderedOCIOptions describes a rendered artifact produced by setup.
type RenderedOCIResult ¶
type RenderedOCIResult struct {
Ref string
ManifestDigest string
LayerDigest string
ObjectSetDigest string
LayerSize int64
ManifestCount int
Files []string
Verified bool
}
RenderedOCIResult describes a verified local write or registry push.
func PublishRenderedOCI ¶
func PublishRenderedOCI(ctx context.Context, opts RenderedOCIOptions) (*RenderedOCIResult, error)
PublishRenderedOCI writes the non-secret rendered manifests as an OCI artifact. An oci:// destination is pushed to a registry. Any other destination is written as a local OCI image layout tagged "latest".