distro

package
v0.28.2 Latest Latest
Warning

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

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

Documentation

Overview

Package distro defines the API types for a distro package.

Index

Constants

View Source
const (
	// CompressionNone writes the image tarballs uncompressed. This is the default.
	CompressionNone = "none"
	// CompressionGzip writes the image tarballs with gzip compression.
	CompressionGzip = "gz"
	// CompressionZstd writes the image tarballs with zstd compression.
	CompressionZstd = "zstd"
)

Compression formats accepted by ZarfDistroImageConfig.Compression.

Variables

This section is empty.

Functions

This section is empty.

Types

type ZarfDistro

type ZarfDistro struct {
	// APIVersion identifies the API group and version of this configuration document.
	APIVersion string `json:"apiVersion,omitempty" jsonschema:"enum=zarf.dev/v1alpha1"`
	// Kind identifies the document type. The value must be ZarfDistro.
	Kind v1alpha1.ZarfDistroKind `json:"kind" jsonschema:"enum=ZarfDistro"`
	// Metadata holds identifying information for the distro package.
	Metadata ZarfDistroMetadata `json:"metadata"`
	// Build holds information recorded when the package was built.
	Build ZarfDistroBuildData `json:"build,omitempty"`
	// Spec holds the configuration for the distro package.
	Spec ZarfDistroSpec `json:"spec"`
}

ZarfDistro is the root object of a distro package configuration document.

func (ZarfDistro) Arches

func (distro ZarfDistro) Arches() api.Arches

Arches returns the CPU architectures the package covers. A built package records them under build, so that is preferred; a definition that has not been built yet only carries what the metadata targets.

func (ZarfDistro) IsSBOMAble

func (distro ZarfDistro) IsSBOMAble() bool

IsSBOMAble reports whether cargoship can generate an SBOM for this distro package. It returns true if the config lists any images or files.

type ZarfDistroActions

type ZarfDistroActions struct {
	// OnCreate lists the actions cargoship runs when it creates the package.
	OnCreate zarf.ZarfComponentActionSet `json:"onCreate,omitempty"`
}

ZarfDistroActions defines the actions cargoship runs during specific phases of building the distro package.

type ZarfDistroBuildData

type ZarfDistroBuildData struct {
	// Architecture is the CPU architecture used to build the package. Populated only when the package targets a single architecture.
	Architecture api.Arch `json:"architecture,omitempty"`
	// Architectures lists the CPU architectures used to build the package.
	Architectures api.Arches `json:"architectures,omitempty"`
	// Timestamp is the time the package was created.
	Timestamp string `json:"timestamp,omitempty"`
	// Version records the distro version used to build the package.
	Version string `json:"version,omitempty"`
	// RegistryOverrides maps each original registry to the registry actually used to build the package.
	RegistryOverrides map[string]string `json:"registryOverrides,omitempty"`
	// Signed indicates whether the package was signed. A nil value means the signing status was not recorded.
	Signed *bool `json:"signed,omitempty"`
	// Reproducible indicates Build.Timestamp was pinned to a fixed value
	// (config.Timestamp) instead of the actual build time, so identical
	// package inputs produce byte-identical output.
	Reproducible bool `json:"reproducible,omitempty"`
	// ProvenanceFiles lists files in the package that checksums.txt does not cover.
	// These are files added after cargoship generates checksums, for example signature files.
	// The signed distro.yaml authenticates this list.
	ProvenanceFiles []string `json:"provenanceFiles,omitempty"`
}

ZarfDistroBuildData holds information recorded when the package was built.

func (ZarfDistroBuildData) Arches

func (b ZarfDistroBuildData) Arches() api.Arches

Arches returns the CPU architectures the package was built for. It prefers Architectures and falls back to the single Architecture field.

type ZarfDistroConfig

type ZarfDistroConfig struct {
	// Files lists files that cargoship writes to every host, no matter which install method it uses.
	Files v1alpha1.ZarfFiles `json:"files,omitempty"`
	// ImagesConfig holds settings for the images bundled with the package.
	ImagesConfig ZarfDistroImageConfig `json:"imageConfig,omitempty"`
	// OS holds settings applied to the host operating system.
	OS ZarfDistroOS `json:"os,omitempty"`
	// Engine holds configuration passed through to the distro engine.
	Engine dig.Mapping `json:"engine,omitempty"`
}

ZarfDistroConfig holds the configuration for the distro engine.

func (ZarfDistroConfig) JSONSchemaExtend

func (ZarfDistroConfig) JSONSchemaExtend(s *jsonschema.Schema)

JSONSchemaExtend pins down the shape of the engine's manifest section, whose values are Helm values written into a HelmChartConfig: either a YAML string or a mapping cargoship serializes to YAML for the chart. Engine is otherwise a free-form mapping handed to the distro engine, so the section list stays open and every other section keeps validating as it did.

type ZarfDistroImageConfig

type ZarfDistroImageConfig struct {
	// Compression sets the compression format for the image tarballs.
	Compression string `json:"compression,omitempty" jsonschema:"default=none,enum=none,enum=gz,enum=zstd"`
	// Path is the upload destination for the image tarballs.
	Path string `json:"path,omitempty"`
	// Images lists the offline images required by the package.
	Images []string `json:"images,omitempty" jsonschema:"uniqueItems=true"`
}

ZarfDistroImageConfig holds settings for the images cargoship writes to a host.

func (ZarfDistroImageConfig) TarballSuffix

func (c ZarfDistroImageConfig) TarballSuffix() (string, error)

TarballSuffix returns the file suffix image tarballs get for the configured compression format. The suffixes match the archive extensions a host imports, so a compressed tarball is still picked up. An unset format means no compression. It returns an error for a format cargoship cannot write.

type ZarfDistroMetadata

type ZarfDistroMetadata struct {
	// Uncompressed disables compression for this package when true.
	Uncompressed bool `json:"uncompressed,omitempty"`
	// Architecture is the CPU architecture this distro package targets. Use Architectures to target more than one.
	Architecture api.Arch `json:"architecture,omitempty" jsonschema:"default=amd64"`
	// Architectures lists the CPU architectures this distro package targets. It supersedes Architecture, which stays valid for a package targeting a single architecture.
	Architectures api.Arches `json:"architectures,omitempty"`
	// Name identifies the distro package.
	Name string `json:"name" jsonschema:"pattern=^[a-z0-9][a-z0-9\\-]*$"`
	// Description explains what this distro package does.
	Description string `json:"description,omitempty"`
	// Version is the distro version cargoship installs. We recommend matching it to the Kubernetes version you install.
	Version string `json:"version,omitempty"`
	// Annotations holds key-value pairs added to the OCI manifest.
	Annotations map[string]string `json:"annotations,omitempty"`
	// URL sets the OCI annotation for more information about the image.
	URL string `json:"url,omitempty"`
	// Authors sets the OCI annotation for the contact details of the people or organization responsible for the image.
	Authors string `json:"athors,omitempty"`
	// Documentation sets the OCI annotation for the URL to the image documentation.
	Documentation string `json:"documentation,omitempty"`
	// Source sets the OCI annotation for the URL to the image source code.
	Source string `json:"source,omitempty"`
	// Vendor sets the OCI annotation for the name of the organization or individual that distributes the image.
	Vendor string `json:"vendor,omitempty"`
	// AggregateChecksum is the checksum of the checksums.txt file, which lists the checksum for every layer in the package.
	AggregateChecksum string `json:"aggregateChecksum,omitempty"`
}

ZarfDistroMetadata holds identifying information for a distro package.

func (ZarfDistroMetadata) Arches

func (m ZarfDistroMetadata) Arches() api.Arches

Arches returns the CPU architectures the package targets. It prefers Architectures and falls back to the single Architecture field, so callers never have to know which one the package set.

type ZarfDistroOS

type ZarfDistroOS struct {
	// Sysctl maps sysctl keys to the values cargoship applies to a host.
	Sysctl map[string]string `json:"sysctl,omitempty"`
	// FAPolicyd holds the fapolicyd config file contents cargoship writes to a host.
	FAPolicyd string `json:"fapolicyd,omitempty"`
	// Files lists files cargoship uploads to a host.
	Files v1alpha1.ZarfFiles `json:"files,omitempty"`
	// Kernel lists the kernel modules cargoship enables on the host.
	Kernel []string `json:"kernel,omitempty"`
	// Environment maps environment variables cargoship sets on the host.
	Environment map[string]string `json:"env,omitempty"`
}

ZarfDistroOS holds settings applied to a host.

func (ZarfDistroOS) JSONSchemaExtend

func (ZarfDistroOS) JSONSchemaExtend(s *jsonschema.Schema)

JSONSchemaExtend widens sysctl values to accept numbers alongside strings, so unquoted numeric values in YAML validate.

type ZarfDistroSpec

type ZarfDistroSpec struct {
	// Type selects the distro engine: rke2, k3s, or upstream.
	Type string `json:"type" jsonschema:"enum=rke2,enum=k3s,enum=upstream"`
	// Version is the version of the distro engine.
	Version string `json:"version"`
	// Actions defines the actions cargoship runs while building the package.
	Actions ZarfDistroActions `json:"actions,omitempty"`
	// Config holds the distro engine configuration.
	Config ZarfDistroConfig `json:"config"`
	// Values holds the default values the package is built with, and the schema they must satisfy.
	Values ZarfDistroValues `json:"values,omitempty"`
}

ZarfDistroSpec holds the configuration for a distro package.

type ZarfDistroValueMapping

type ZarfDistroValueMapping struct {
	// Source is the dotted path to read from the resolved values, e.g. .cilium.encryption.enabled
	Source string `json:"source" jsonschema:"example=.cilium.encryption.enabled"`
	// Target is the dotted path to write, relative to spec.config.engine,
	// e.g. .manifest.rke2-cilium.encryption.enabled
	Target string `json:"target" jsonschema:"example=.manifest.rke2-cilium.encryption.enabled"`
}

ZarfDistroValueMapping projects one value onto one place in the engine configuration.

type ZarfDistroValues

type ZarfDistroValues struct {
	// Files lists the YAML values files cargoship merges, in order, to build the package's default values. Each entry is a path relative to the package definition, an absolute path, or a URL. A later file overrides an earlier one, key by key.
	Files []string `json:"files,omitempty" jsonschema:"example=values.yaml,example=overrides/prod.yaml,example=https://example.com/values.yaml"`
	// Schema is the JSON Schema document the merged values must satisfy. Cargoship checks the values against it when it builds the package, and refuses to build when they do not match. The schema must not use $ref.
	Schema string `json:"schema,omitempty" jsonschema:"example=values.schema.json"`
	// Mappings project values onto the engine configuration, so that one value a
	// cluster sets reaches wherever the distro needs it. Each mapping reads the
	// source path out of the resolved values and writes it to the target path,
	// which is relative to spec.config.engine. A source the values do not define
	// is left alone, so the package's own engine configuration stands as the
	// default.
	Mappings []ZarfDistroValueMapping `json:"mappings,omitempty"`
}

ZarfDistroValues declares the values a package ships with. Values are the Helm-style configuration described by ZEP-0021: a nested structure addressed by dotted paths, which templates in the package read as .Values.

Jump to

Keyboard shortcuts

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