oci

package
v0.0.10 Latest Latest
Warning

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

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

Documentation

Overview

Package oci wraps the shared giantswarm/klaus-oci library and adds klausctl-specific helpers such as CLI cache paths, plugin directory resolution, and container mount path computation.

All OCI media types, metadata types, annotation constants, and the ORAS-based Client come from the shared library. klausctl code should import this package rather than klaus-oci directly to avoid import alias churn.

Index

Constants

View Source
const (
	MediaTypePluginConfig       = klausoci.MediaTypePluginConfig
	MediaTypePluginContent      = klausoci.MediaTypePluginContent
	MediaTypePersonalityConfig  = klausoci.MediaTypePersonalityConfig
	MediaTypePersonalityContent = klausoci.MediaTypePersonalityContent

	AnnotationKlausType    = klausoci.AnnotationKlausType
	AnnotationKlausName    = klausoci.AnnotationKlausName
	AnnotationKlausVersion = klausoci.AnnotationKlausVersion

	TypePlugin      = klausoci.TypePlugin
	TypePersonality = klausoci.TypePersonality
	TypeToolchain   = klausoci.TypeToolchain
)

Re-exported media type and annotation constants.

View Source
const (
	DefaultPluginRegistry      = "gsoci.azurecr.io/giantswarm/klaus-plugins"
	DefaultPersonalityRegistry = "gsoci.azurecr.io/giantswarm/klaus-personalities"
	DefaultToolchainRegistry   = "gsoci.azurecr.io/giantswarm"
)

DefaultRegistries defines the default OCI registry base paths for each artifact type, used by the list --remote commands.

View Source
const RegistryAuthEnvVar = "KLAUSCTL_REGISTRY_AUTH"

RegistryAuthEnvVar is the environment variable checked for base64-encoded Docker config JSON credentials. This supplements the default Docker/Podman config file resolution and is primarily useful in CI/headless environments where `az acr login` is not available.

Variables

View Source
var (
	NewClient           = klausoci.NewClient
	WithPlainHTTP       = klausoci.WithPlainHTTP
	WithRegistryAuthEnv = klausoci.WithRegistryAuthEnv

	PluginArtifact      = klausoci.PluginArtifact
	PersonalityArtifact = klausoci.PersonalityArtifact

	IsCached       = klausoci.IsCached
	ReadCacheEntry = klausoci.ReadCacheEntry

	ShortName      = klausoci.ShortName
	TruncateDigest = klausoci.TruncateDigest
)

Re-exported constructors, options, and helpers.

Functions

func BuildRef added in v0.0.9

func BuildRef(p config.Plugin) string

BuildRef constructs a full OCI reference from a Plugin spec.

func HasSOULFile added in v0.0.10

func HasSOULFile(personalityDir string) bool

HasSOULFile reports whether a pulled personality directory contains a SOUL.md.

func MergePlugins added in v0.0.10

func MergePlugins(personalityPlugins []PluginReference, userPlugins []config.Plugin) []config.Plugin

MergePlugins merges personality plugins with user-configured plugins. User plugins take precedence: if a personality plugin and a user plugin share the same repository, the user's version is kept. Personality-only plugins are appended after user plugins.

func PluginDirs

func PluginDirs(plugins []config.Plugin) []string

PluginDirs returns the container-internal mount paths for the given plugins. Each plugin is mounted at /var/lib/klaus/plugins/<shortName>.

func PluginFromReference added in v0.0.10

func PluginFromReference(ref PluginReference) config.Plugin

PluginFromReference converts a klaus-oci PluginReference to a config.Plugin.

func PullPlugins

func PullPlugins(ctx context.Context, plugins []config.Plugin, pluginsDir string, w io.Writer) error

PullPlugins pulls all configured plugins to the local plugins directory. Each plugin is stored at <pluginsDir>/<shortName>/. Plugins are cached by digest and skipped if already up-to-date. Progress messages are written to w.

func ShortPluginName

func ShortPluginName(repository string) string

ShortPluginName extracts the last segment of a repository path. e.g. "gsoci.azurecr.io/giantswarm/klaus-plugins/gs-platform" -> "gs-platform"

func ToolchainRegistryRef added in v0.0.9

func ToolchainRegistryRef(name string) string

ToolchainRegistryRef returns the full registry reference for a toolchain image name. Toolchains use the pattern gsoci.azurecr.io/giantswarm/klaus-<name>.

Types

type ArtifactInfo added in v0.0.9

type ArtifactInfo = klausoci.ArtifactInfo

Re-exported types from the shared klaus-oci library.

type ArtifactKind added in v0.0.9

type ArtifactKind = klausoci.ArtifactKind

Re-exported types from the shared klaus-oci library.

type CacheEntry added in v0.0.3

type CacheEntry = klausoci.CacheEntry

Re-exported types from the shared klaus-oci library.

type Client added in v0.0.3

type Client = klausoci.Client

Re-exported types from the shared klaus-oci library.

func NewDefaultClient added in v0.0.9

func NewDefaultClient(opts ...ClientOption) *Client

NewDefaultClient creates an OCI client configured with the standard klausctl credential resolution: Docker/Podman config files plus the KLAUSCTL_REGISTRY_AUTH environment variable.

type ClientOption added in v0.0.3

type ClientOption = klausoci.ClientOption

Re-exported types from the shared klaus-oci library.

type PersonalityMeta added in v0.0.9

type PersonalityMeta = klausoci.PersonalityMeta

Re-exported types from the shared klaus-oci library.

type PersonalityResult added in v0.0.10

type PersonalityResult struct {
	// Spec is the parsed personality.yaml content.
	Spec PersonalitySpec
	// Dir is the local directory where the personality was pulled.
	Dir string
	// ShortName is the short name extracted from the OCI reference.
	ShortName string
}

PersonalityResult holds the outcome of resolving a personality artifact.

func ResolvePersonality added in v0.0.10

func ResolvePersonality(ctx context.Context, ref, personalitiesDir string, w io.Writer) (*PersonalityResult, error)

ResolvePersonality pulls a personality OCI artifact and parses its spec. The personality is stored at <personalitiesDir>/<shortName>/.

type PersonalitySpec added in v0.0.9

type PersonalitySpec = klausoci.PersonalitySpec

Re-exported types from the shared klaus-oci library.

func LoadPersonalitySpec added in v0.0.10

func LoadPersonalitySpec(dir string) (PersonalitySpec, error)

LoadPersonalitySpec reads and parses a personality.yaml from the given directory.

type PluginMeta added in v0.0.3

type PluginMeta = klausoci.PluginMeta

Re-exported types from the shared klaus-oci library.

type PluginReference added in v0.0.9

type PluginReference = klausoci.PluginReference

Re-exported types from the shared klaus-oci library.

type PullResult added in v0.0.3

type PullResult = klausoci.PullResult

Re-exported types from the shared klaus-oci library.

type PushResult added in v0.0.3

type PushResult = klausoci.PushResult

Re-exported types from the shared klaus-oci library.

type ToolchainMeta added in v0.0.9

type ToolchainMeta = klausoci.ToolchainMeta

Re-exported types from the shared klaus-oci library.

Jump to

Keyboard shortcuts

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