dependencies

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package dependencies defines and resolves runtime dependencies for the Podmin CLI.

Index

Constants

View Source
const ManifestPath = "dependencies/manifest.json"

ManifestPath is the authoritative dependency manifest object key.

Variables

View Source
var Catalog = []Dependency{
	{
		Key: "containerd", Major: 2,
		Releases:          "https://api.github.com/repos/containerd/containerd/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "containerd-{version}-linux-{architecture}.tar.gz",
		AssetURL:          "https://github.com/containerd/containerd/releases/download/v{version}/{asset}",
		ChecksumURL:       "{url}.sha256sum",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha256",
		ObjectName:        "containerd.tar.gz",
	},
	{
		Key: "gvisor", ReleaseStyle: gvisorRelease,
		Releases:          "https://api.github.com/repos/google/gvisor/tags?per_page=100",
		Architectures:     map[string]string{"amd64": "x86_64", "arm64": "aarch64"},
		AssetName:         "gvisor.tar.bz2",
		AssetURL:          "https://storage.googleapis.com/gvisor/releases/release/{version}/{architecture}/{asset}",
		ChecksumURL:       "{url}.sha512",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha512",
		ObjectName:        "gvisor.tar.bz2",
	},
	{
		Key: "cni-plugins", Major: 1,
		Releases:          "https://api.github.com/repos/containernetworking/plugins/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "cni-plugins-linux-{architecture}-v{version}.tgz",
		AssetURL:          "https://github.com/containernetworking/plugins/releases/download/v{version}/{asset}",
		ChecksumURL:       "{url}.sha256",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha256",
		ObjectName:        "cni-plugins.tar.gz",
	},
	{
		Key: "kubelet", Major: 1, Minor: 36,
		Releases:          "https://api.github.com/repos/kubernetes/kubernetes/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "kubelet",
		AssetURL:          "https://dl.k8s.io/release/v{version}/bin/linux/{architecture}/kubelet",
		ChecksumURL:       "{url}.sha512",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha512",
		ObjectName:        "kubelet",
	},
	{
		Key: "crictl", Major: 1, Minor: 36,
		Releases:          "https://api.github.com/repos/kubernetes-sigs/cri-tools/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "crictl-v{version}-linux-{architecture}.tar.gz",
		AssetURL:          "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{version}/{asset}",
		ChecksumURL:       "{url}.sha512",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha512",
		ObjectName:        "crictl.tar.gz",
	},
	{
		Key: "coredns", Major: 1,
		Releases:          "https://api.github.com/repos/coredns/coredns/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "coredns_{version}_linux_{architecture}.tgz",
		AssetURL:          "https://github.com/coredns/coredns/releases/download/v{version}/{asset}",
		ChecksumURL:       "{url}.sha256",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha256",
		ObjectName:        "coredns.tar.gz",
	},
	{
		Key: "zot", Major: 2,
		Releases:          "https://api.github.com/repos/project-zot/zot/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "zot-linux-{architecture}-minimal",
		AssetURL:          "https://github.com/project-zot/zot/releases/download/v{version}/{asset}",
		ChecksumURL:       "https://github.com/project-zot/zot/releases/download/v{version}/checksums.sha256.txt",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha256",
		ObjectName:        "zot",
	},
	{
		Key: "podmin-agent", ReleaseStyle: agentRelease,
		Releases:          "https://api.github.com/repos/podmin-dev/podmin/releases",
		Architectures:     map[string]string{"amd64": "amd64", "arm64": "arm64"},
		AssetName:         "podmin-agent_{version}_linux_{architecture}.tar.gz",
		AssetURL:          "https://github.com/podmin-dev/podmin/releases/download/v{version}/{asset}",
		ChecksumURL:       "https://github.com/podmin-dev/podmin/releases/download/v{version}/podmin_{version}_checksums.txt",
		ChecksumName:      "{asset}",
		ChecksumAlgorithm: "sha512",
		ObjectName:        "podmin-agent.tar.gz",
	},
}

Catalog is the complete runtime dependency catalog. URL fields accept {version}, {architecture}, {asset}, and {url} substitutions.

Functions

func Resolve

func Resolve(ctx context.Context, client *http.Client, dependency Dependency) (string, error)

Resolve returns the greatest stable release satisfying the version constraint.

func SameFile added in v0.2.0

func SameFile(file File, artifact Artifact) bool

SameFile reports whether a published file satisfies a resolved artifact.

func SameImage added in v0.2.0

func SameImage(published, desired Image) bool

SameImage reports whether two image records identify the same published image.

Types

type Artifact

type Artifact struct {
	Key          string
	Name         string
	Version      string
	Architecture string
	URL          string
	ObjectKey    string
	Digest       string
	Path         string
	Size         int64
}

Artifact is one verified architecture-specific bootstrap dependency.

type Dependency

type Dependency struct {
	Key               string
	Major             int
	Minor             int
	ReleaseStyle      releaseStyle
	Releases          string
	Architectures     map[string]string
	AssetName         string
	AssetURL          string
	ChecksumURL       string
	ChecksumName      string
	ChecksumAlgorithm string
	ObjectName        string
}

Dependency describes one version-constrained upstream artifact.

type Fetcher

type Fetcher struct {
	Client       *http.Client
	CacheDir     string
	SourceDir    string
	AgentVersion string
	Progress     tui.Progress
	// contains filtered or unexported fields
}

Fetcher resolves and caches the canonical bootstrap dependencies.

func (*Fetcher) Download added in v0.2.0

func (f *Fetcher) Download(ctx context.Context, artifacts []Artifact) ([]Artifact, error)

Download validates cached artifacts and downloads only missing or corrupt files.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, architecture string) ([]Artifact, error)

Fetch downloads and verifies every dependency required by architecture.

func (*Fetcher) Resolve added in v0.2.0

func (f *Fetcher) Resolve(ctx context.Context, architecture string) ([]Artifact, error)

Resolve selects versions and checksums without downloading artifacts.

type File added in v0.2.0

type File struct {
	Version string `json:"version"`
	URL     string `json:"url"`
	Path    string `json:"path"`
	Digest  string `json:"digest"`
	Size    int64  `json:"size"`
}

File records one architecture-specific dependency file.

type Image added in v0.2.0

type Image struct {
	Version string `json:"version"`
	Source  string `json:"source"`
	Path    string `json:"path"`
	Digest  string `json:"digest"`
	Size    int64  `json:"size"`
}

Image records one setup-managed OCI image.

type Manifest added in v0.2.0

type Manifest struct {
	Version      int                        `json:"version"`
	Dependencies map[string]map[string]File `json:"dependencies"`
	Images       map[string]Image           `json:"images"`
}

Manifest records the dependency files and images published for a cluster.

func NewManifest added in v0.2.0

func NewManifest(artifacts map[string][]Artifact, images map[string]Image) Manifest

NewManifest creates a manifest from resolved artifacts and images.

func ParseManifest added in v0.2.0

func ParseManifest(body []byte) (Manifest, error)

ParseManifest parses and validates a dependency manifest.

func (Manifest) Marshal added in v0.2.0

func (m Manifest) Marshal() ([]byte, error)

Marshal validates and encodes a dependency manifest deterministically.

func (Manifest) Validate added in v0.2.0

func (m Manifest) Validate() error

Validate checks the manifest version and every published object.

type Object

type Object struct {
	Key, Group, Version string
	Modified            time.Time
}

Object is retention metadata for one uploaded dependency object.

func Expired

func Expired(objects []Object, now time.Time) []Object

Expired selects versions beyond the newest two when all their objects are 28 days old.

Jump to

Keyboard shortcuts

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