pkg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 29 Imported by: 0

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

View Source
const ManifestFile = "installer.yaml"

Variables

This section is empty.

Functions

func List

func List(ctx context.Context, repoRef string) ([]string, error)

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

func Login(ctx context.Context, registry, username, password string) error

Login stores a credential for registry. Credentials are written to the docker-config store, so they are shared with docker, podman, and oras.

func Logout

func Logout(ctx context.Context, registry string) error

Logout removes credentials for registry from the docker-config store.

func Pull

func Pull(ctx context.Context, ref, dest string) (string, error)

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

func PullToWorkDir(ctx context.Context, ref, workDir string) (string, error)

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

func ResolveManifestDigest(ctx context.Context, ref string) (string, error)

ResolveManifestDigest resolves an OCI reference without pulling its layers.

func Tag

func Tag(ctx context.Context, srcRef, dstTag string) error

Tag points dstTag at the same manifest digest as srcRef. The original tag, if any, is preserved. srcRef is a full ref (oci://host/repo:tag or oci://host/repo@sha256:...); dstTag is a bare tag name.

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.

func Inspect

func Inspect(ctx context.Context, ref string) (*InspectResult, error)

Inspect fetches only the manifest + config blob for a native installer artifact. The layer is not pulled, making this cheap enough for the resolver to call on every dependency candidate.

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.

func Load

func Load(dir string) (*Loaded, error)

Load reads installer.yaml from a local directory and returns the parsed package. Use Pull to fetch a remote artifact first.

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".

Jump to

Keyboard shortcuts

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