registry

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

pkg/registry/client.go

ORAS-based OCI client for pushing and pulling Orkestra patterns.

Authentication uses ~/.docker/config.json via oras.land/oras-go/v2. No separate login step — docker login ghcr.io is sufficient.

Push: validates the directory, reads each file, pushes as OCI layers. Pull: fetches the manifest, extracts layers to the cache directory. Info: fetches the manifest only, reads annotations. List: fetches the index artifact from the registry root.

pkg/registry/pattern.go

Pattern is the atomic unit of the Orkestra Registry. A pattern directory contains:

katalog.yaml  — operator declaration (required)
crd.yaml      — CRD schema (required)
README.md     — human documentation (optional)
cr.yaml       — example CR (optional)
pattern.yaml  — registry metadata (optional, overrides derived fields)

The pattern metadata is primarily derived from katalog.yaml (metadata.name, metadata.version, metadata.author, metadata.description, spec.providers). If pattern.yaml is present, its fields override the derived values.

pkg/registry/resolve.go

Reference resolution for ork registry commands.

A bare reference like "postgres:v14" is resolved to a full OCI reference using the following priority:

  1. Full OCI reference (starts with "oci://") — used as-is
  2. ORKESTRA_REGISTRY env var + "/name:version"
  3. Default: ghcr.io/orkspace/orkestra-registry/name:version

The "oci://" prefix is stripped before passing to ORAS — it is a user-facing convention to signal "this is an OCI reference", not part of the actual URL.

Index

Constants

View Source
const (
	// MediaType is the OCI artifact media type for Orkestra patterns.
	MediaType = "application/vnd.orkestra.pattern.v1+tar+gzip"

	// FileKatalog is the required operator declaration file.
	FileKatalog = "katalog.yaml"

	// FileCRD is the required CRD schema file.
	FileCRD = "crd.yaml"

	// FilePattern is the optional registry metadata file.
	FilePattern = "pattern.yaml"

	// FileReadme is the human documentation file.
	FileReadme = "README.md"

	// FileCR is the example CR file.
	FileCR = "cr.yaml"
)
View Source
const (
	// DefaultRegistry is the official Orkestra pattern registry.
	DefaultRegistry = "ghcr.io/orkspace/orkestra-registry/patterns"

	// EnvRegistry is the environment variable for overriding the registry.
	EnvRegistry = "ORKESTRA_REGISTRY"

	// CacheDir is the local cache directory for pulled patterns.
	// Resolved relative to the user's home directory.
	CacheDir = ".orkestra/registry"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangelogEntry

type ChangelogEntry struct {
	Version string `yaml:"version"`
	Notes   string `yaml:"notes"`
}

ChangelogEntry is one version entry in the changelog.

type Client

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

Client wraps ORAS for Orkestra pattern operations.

func NewClient

func NewClient() (*Client, error)

NewClient returns a Client with credentials loaded from the Docker config.

func (*Client) Info

func (c *Client) Info(ctx context.Context, ref *Ref) (*PatternInfo, error)

Info fetches manifest metadata without downloading the pattern files.

func (*Client) List

func (c *Client) List(ctx context.Context, registryURL string) (*PatternIndex, error)

List enumerates patterns in the registry by walking its repository catalog. For each repository under the base namespace, it fetches the manifest annotations to build the pattern index on the fly.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, ref *Ref, refresh bool) (string, error)

Pull fetches a pattern from the registry into the local cache. Returns the cache directory path.

func (*Client) Push

func (c *Client) Push(ctx context.Context, ref *Ref, dir string, progress func(file string, size int64)) (string, error)

Push validates the directory and pushes all pattern files to the registry. Returns the manifest digest on success.

type PatternEntry

type PatternEntry struct {
	Name          string   `json:"name"`
	LatestVersion string   `json:"latestVersion"`
	Description   string   `json:"description"`
	Tags          []string `json:"tags"`
	Author        string   `json:"author,omitempty"`
}

PatternEntry is one row in the pattern index.

type PatternIndex

type PatternIndex struct {
	UpdatedAt string         `json:"updatedAt"`
	Patterns  []PatternEntry `json:"patterns"`
}

PatternIndex is the top-level index stored at registry/index:latest.

type PatternInfo

type PatternInfo struct {
	Ref      *Ref
	Digest   string
	Size     int64
	PushedAt time.Time
	Meta     *PatternMeta
}

PatternInfo holds the metadata returned by Info.

type PatternMeta

type PatternMeta struct {
	Name        string           `yaml:"name"`
	Version     string           `yaml:"version"`
	Description string           `yaml:"description"`
	Author      string           `yaml:"author,omitempty"`
	License     string           `yaml:"license,omitempty"`
	Tags        []string         `yaml:"tags,omitempty"`
	Requires    PatternRequires  `yaml:"requires,omitempty"`
	Changelog   []ChangelogEntry `yaml:"changelog,omitempty"`
}

PatternMeta is the schema for pattern metadata. Derived from katalog.yaml (and optionally pattern.yaml/CRD).

func LoadPatternMeta

func LoadPatternMeta(dir string) (*PatternMeta, error)

LoadPatternMeta reads pattern metadata from the given directory, following the same derivation rules as ValidateDirectory.

func ValidateDirectory

func ValidateDirectory(dir string) (*PatternMeta, []string, error)

ValidateDirectory validates that dir contains a valid pattern. Returns the pattern metadata (derived from katalog.yaml, overridden by pattern.yaml if present), and the list of files to include in the OCI artifact.

func (*PatternMeta) Validate

func (m *PatternMeta) Validate() error

Validate checks required fields.

type PatternRequires

type PatternRequires struct {
	Providers []string `yaml:"providers,omitempty"`
}

PatternRequires declares external dependencies.

type Ref

type Ref struct {
	// Registry is the hostname (e.g. "ghcr.io").
	Registry string

	// Repository is the full repository path without the registry
	// (e.g. "orkspace/orkestra-registry/postgres").
	Repository string

	// Tag is the version tag (e.g. "v14").
	Tag string

	// Full is the complete reference without the oci:// prefix.
	// Suitable for passing directly to ORAS.
	Full string
}

Ref holds a resolved OCI reference.

func Resolve

func Resolve(input string) (*Ref, error)

Resolve converts a user-supplied reference to a fully qualified OCI Ref.

"postgres:v14"                          → ghcr.io/orkspace/orkestra-registry/postgres:v14
"oci://ghcr.io/myorg/patterns/redis:v7" → ghcr.io/myorg/patterns/redis:v7
"myorg/redis:v7" (with ORKESTRA_REGISTRY set) → resolved against env

func (*Ref) CachePath

func (r *Ref) CachePath() (string, error)

CachePath returns the local filesystem path for this ref. Structure: ~/.orkestra/registry/<registry>/<repository>/<tag>/

func (*Ref) IsCached

func (r *Ref) IsCached() bool

IsCached returns true when the pattern is already in the local cache.

func (*Ref) ShortName

func (r *Ref) ShortName() string

ShortName returns the name:tag portion for display.

func (*Ref) String

func (r *Ref) String() string

String returns the full reference with oci:// prefix for display.

Jump to

Keyboard shortcuts

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