oci

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package oci is the minimal OCI distribution client agent-manager needs: anonymous pulls with the registry's bearer-token challenge (RFC 6750 style Www-Authenticate), the tag list of a repository, one file out of a Helm chart archive, and the digest a tag resolves to — the way Flux's source-controller reads the agent chart, and the way a tagged skill image is pinned to the digest kagent requires.

Index

Constants

View Source
const (
	// HelmChartLayerMediaType is the media type of a chart archive layer.
	HelmChartLayerMediaType = "application/vnd.cncf.helm.chart.content.v1.tar+gzip"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageReference

type ImageReference struct {
	Reference
	Tag    string
	Digest string
}

ImageReference is a parsed image reference: <host>/<repository>[:<tag>][@<digest>].

func ParseImageReference

func ParseImageReference(ref string) (ImageReference, error)

ParseImageReference parses <host>/<repository>[:<tag>][@sha256:<digest>]. The registry host is required (no Docker Hub defaulting): a skill reference names where it comes from.

func (ImageReference) Pinned

func (r ImageReference) Pinned() string

Pinned renders the reference by digest, the immutable form.

type Reference

type Reference struct {
	// Host is the registry host, e.g. gsoci.azurecr.io.
	Host string
	// Repository is the path within the registry, e.g. charts/giantswarm/agent.
	Repository string
	// Insecure selects plain HTTP (tests).
	Insecure bool
}

Reference is a parsed registry repository.

func ParseChartURL

func ParseChartURL(ociURL string) (Reference, error)

ParseChartURL parses oci://<host>/<repository>, the form a Flux OCIRepository carries.

func (Reference) Name

func (r Reference) Name() string

Name is the last path segment of the repository (the chart name).

type Registry

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

Registry talks to OCI registries.

func NewRegistry

func NewRegistry(client *http.Client) *Registry

NewRegistry builds a client with sensible timeouts.

func (*Registry) ListTags

func (c *Registry) ListTags(ctx context.Context, ref Reference) ([]string, error)

ListTags returns the repository's tags.

func (*Registry) ManifestDigest

func (c *Registry) ManifestDigest(ctx context.Context, ref Reference, tag string) (string, error)

ManifestDigest resolves a tag to the digest of its manifest: the registry's Docker-Content-Digest on a HEAD, else the sha256 of the manifest body.

func (*Registry) ReadChartFile

func (c *Registry) ReadChartFile(ctx context.Context, ref Reference, tag, file string) ([]byte, error)

ReadChartFile pulls the chart at tag and returns the named file from the archive (relative to the chart root, e.g. values.schema.json).

Directories

Path Synopsis
Package ocitest is a fake OCI distribution registry for tests: one repository behind a bearer challenge, a tag list, one manifest per tag with a Docker-Content-Digest, and a chart archive per tag as the single blob.
Package ocitest is a fake OCI distribution registry for tests: one repository behind a bearer challenge, a tag list, one manifest per tag with a Docker-Content-Digest, and a chart archive per tag as the single blob.

Jump to

Keyboard shortcuts

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