types

package
v0.83.0 Latest Latest
Warning

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

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

Documentation

Overview

Package types holds the internal generic representation of a Zarf package used for lossless conversions between API versions. This type is never exposed publicly. Each API version converts to/from this type, giving N conversion functions instead of N². The shape mirrors the latest schema (v1beta1) with extra fields appended where earlier versions carry data that does not survive untouched on the latest schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildData

type BuildData struct {
	// Hostname is the v1beta1 name (v1alpha1: Terminal).
	Hostname                   string
	User                       string
	Architecture               string
	Timestamp                  string
	Version                    string
	Migrations                 []string
	RegistryOverrides          map[string]string
	Differential               bool
	DifferentialPackageVersion string
	Flavor                     string
	Signed                     *bool
	VersionRequirements        []VersionRequirement
	ProvenanceFiles            []string
	AggregateChecksum          string
	// OriginalAPIVersion tracks the apiVersion the package was read from before any conversion.
	OriginalAPIVersion string

	// v1alpha1-only build fields.
	DifferentialMissing []string
}

BuildData is the superset of build fields across API versions.

type Chart

type Chart struct {
	Name                 string
	Namespace            string
	ReleaseName          string
	ValuesFiles          []ValuesFile
	Values               []ChartValue
	SkipSchemaValidation bool
	ServerSideApply      string
	SkipWait             bool

	// v1beta1 structured sources.
	HelmRepository *HelmRepositorySource
	Git            *GitSource
	Local          *LocalSource
	OCI            *OCISource

	// v1alpha1-only flat source fields. Used during conversion to populate structured sources.
	URL              string
	RepoName         string
	GitPath          string
	LocalPath        string
	Version          string
	SchemaValidation *bool
	Variables        []ZarfChartVariable
}

Chart is the superset of chart fields across API versions.

type ChartValue

type ChartValue struct {
	SourcePath   string
	TargetPath   string
	ExcludePaths []string
}

ChartValue maps a source path to a target path.

type Component

type Component struct {
	Name          string
	Description   string
	Optional      bool
	Target        ComponentTarget
	Import        ComponentImport
	Service       string
	Manifests     []Manifest
	Charts        []Chart
	Files         []File
	Images        []Image
	ImageArchives []ImageArchive
	Repositories  []Repository
	StateAccess   []string
	Actions       ComponentActions

	// v1alpha1-only fields preserved for lossless round-trip.
	Default           bool
	Required          *bool
	Group             string
	DataInjections    []ZarfDataInjection
	HealthChecks      []NamespacedObjectKindReference
	Distros           []string
	DeprecatedScripts DeprecatedComponentScripts
}

Component is the superset of component fields across API versions.

type ComponentAction

type ComponentAction struct {
	Silent           *bool
	MaxTotalSeconds  *int32
	Retries          *int32
	Dir              *string
	Env              []string
	Cmd              string
	Shell            *Shell
	SetValues        []SetValue
	Description      string
	Wait             *ComponentActionWait
	EnableTemplating bool

	// v1alpha1-only round-trip fields.
	SetVariables          []Variable
	DeprecatedSetVariable string
	// Template is the v1alpha1 *bool preserved so an unset value round-trips losslessly.
	Template *bool
}

ComponentAction is the superset of action fields across API versions.

type ComponentActionDefaults

type ComponentActionDefaults struct {
	Silent          bool
	MaxTotalSeconds int32
	Retries         int32
	Dir             string
	Env             []string
	Shell           Shell
}

ComponentActionDefaults sets defaults for child actions.

type ComponentActionSet

type ComponentActionSet struct {
	Defaults  ComponentActionDefaults
	Before    []ComponentAction
	OnSuccess []ComponentAction
	OnFailure []ComponentAction

	// After is the v1alpha1-only "run at the end of an operation" hook, preserved for lossless
	// round-trips. v1beta1 has no equivalent and folds these into OnSuccess on conversion.
	After []ComponentAction
}

ComponentActionSet is a set of actions for one lifecycle operation.

type ComponentActionWait

type ComponentActionWait struct {
	Cluster *ComponentActionWaitCluster
	Network *ComponentActionWaitNetwork
}

ComponentActionWait specifies a condition to wait for before continuing.

type ComponentActionWaitCluster

type ComponentActionWaitCluster struct {
	Kind      string
	Name      string
	Namespace string
	Condition string
}

ComponentActionWaitCluster specifies a cluster-level wait condition.

type ComponentActionWaitNetwork

type ComponentActionWaitNetwork struct {
	Protocol string
	Address  string
	Code     int32
}

ComponentActionWaitNetwork specifies a network-level wait condition.

type ComponentActions

type ComponentActions struct {
	OnCreate ComponentActionSet
	OnDeploy ComponentActionSet
	OnRemove ComponentActionSet
}

ComponentActions are ActionSets mapped to package lifecycle operations.

type ComponentImport

type ComponentImport struct {
	// v1beta1 form: separate lists of local and remote component config references.
	Local  []ComponentImportLocal
	Remote []ComponentImportRemote

	// v1alpha1-only single-import fields.
	Name string
	Path string
	URL  string
}

ComponentImport carries imports from any API version.

type ComponentImportLocal

type ComponentImportLocal struct {
	Path string
}

ComponentImportLocal references a local component config file.

type ComponentImportRemote

type ComponentImportRemote struct {
	URL string
}

ComponentImportRemote references a remote (OCI) component config.

type ComponentTarget

type ComponentTarget struct {
	OS           string
	Architecture string
	Flavor       string
}

ComponentTarget filters a component to a target OS/arch/flavor.

type Constant

type Constant struct {
	Name        string
	Value       string
	Description string
	AutoIndent  bool
	Pattern     string
}

Constant is a value that can be used to dynamically template resources or run in actions.

type DeprecatedComponentScripts

type DeprecatedComponentScripts struct {
	ShowOutput     bool
	TimeoutSeconds int
	Retry          bool
	Prepare        []string
	Before         []string
	After          []string
}

DeprecatedComponentScripts is the v1alpha1-only pre-actions scripts block, preserved for lossless round-trip.

type File

type File struct {
	Source           string
	Checksum         string
	Destination      string
	Executable       bool
	Symlinks         []string
	ExtractPath      string
	EnableTemplating bool
	// Template is the v1alpha1 *bool preserved so an unset value round-trips losslessly.
	Template *bool
}

File is the superset of file fields across API versions.

type GitRef

type GitRef struct {
	Tag    string
	Branch string
	Commit string
}

GitRef selects a single Git reference.

type GitSource

type GitSource struct {
	URL  string
	Path string
	Ref  *GitRef
}

GitSource represents a chart stored in a Git repository.

type HelmRepositorySource

type HelmRepositorySource struct {
	Name    string
	URL     string
	Version string
}

HelmRepositorySource represents a chart stored in a Helm repository.

type Image

type Image struct {
	Name   string
	Source string
}

Image represents an OCI image in the package.

type ImageArchive

type ImageArchive struct {
	Path   string
	Images []string
}

ImageArchive defines a tar archive of images to include in the package.

type InteractiveVariable

type InteractiveVariable struct {
	Variable
	Description string
	Default     string
	Prompt      bool
}

InteractiveVariable is a variable that can prompt a user for more information.

type KustomizeManifest

type KustomizeManifest struct {
	Files             []string
	AllowAnyDirectory bool
	EnablePlugins     bool
}

KustomizeManifest holds kustomization settings for a manifest.

type LocalSource

type LocalSource struct {
	Path string
}

LocalSource represents a chart stored locally.

type Manifest

type Manifest struct {
	Name             string
	Namespace        string
	Files            []string
	Kustomize        *KustomizeManifest
	SkipWait         bool
	ServerSideApply  string
	EnableTemplating bool

	// v1alpha1-only round-trip fields.
	Template *bool
}

Manifest is the superset of manifest fields across API versions.

type NamespacedObjectKindReference

type NamespacedObjectKindReference struct {
	APIVersion string
	Kind       string
	Namespace  string
	Name       string
}

NamespacedObjectKindReference references a cluster resource targeted by a health check.

type OCIRef

type OCIRef struct {
	Tag    string
	Digest string
}

OCIRef selects a single OCI reference.

type OCISource

type OCISource struct {
	URL     string
	Version string
	Ref     *OCIRef
}

OCISource represents a chart stored in an OCI registry.

type Package

type Package struct {
	APIVersion    string
	Kind          string
	Metadata      PackageMetadata
	Build         BuildData
	Components    []Component
	Values        Values
	Documentation map[string]string

	// v1alpha1-only fields preserved for lossless round-trip.
	Variables []InteractiveVariable
	Constants []Constant
}

Package is the internal superset representation used for conversions between API versions.

type PackageMetadata

type PackageMetadata struct {
	Name         string
	Description  string
	Version      string
	Uncompressed bool
	Architecture string
	Annotations  map[string]string
	// PreventNamespaceOverride is the v1beta1 form. v1alpha1 stores AllowNamespaceOverride *bool;
	// only one of these should be populated by the converter.
	PreventNamespaceOverride bool
	AllowNamespaceOverride   *bool

	// v1alpha1-only metadata fields. v1beta1 migrates these to Annotations.
	URL           string
	Image         string
	YOLO          bool
	Authors       string
	Documentation string
	Source        string
	Vendor        string
	// AggregateChecksum lives in Metadata on v1alpha1 and in Build on v1beta1.
	AggregateChecksum string
}

PackageMetadata is the superset of metadata fields across API versions.

type Repository

type Repository struct {
	URL string
	Ref *GitRef
}

Repository defines a git repository.

type SetValue

type SetValue struct {
	Key   string
	Value any
	Type  string
}

SetValue declares a value that can be set during a deploy.

type Shell

type Shell struct {
	Windows string
	Linux   string
	Darwin  string
}

Shell represents shell preferences per OS.

type Values

type Values struct {
	Files  []string
	Schema string
}

Values defines values files and schema.

type ValuesFile

type ValuesFile struct {
	Path             string
	EnableTemplating bool
}

ValuesFile is a values file merged into a Helm chart, optionally rendered with Zarf templating.

type Variable

type Variable struct {
	Name       string
	Sensitive  bool
	AutoIndent bool
	Pattern    string
	Type       VariableType
}

Variable represents a variable that has a value set programmatically.

type VariableType

type VariableType string

VariableType represents a type of a Zarf package variable.

const (
	// RawVariableType is the default type for a Zarf package variable.
	RawVariableType VariableType = "raw"
	// FileVariableType loads a variable's contents from a file.
	FileVariableType VariableType = "file"
)

type VersionRequirement

type VersionRequirement struct {
	Version string
	Reason  string
}

VersionRequirement specifies a minimum Zarf version needed.

type ZarfChartVariable

type ZarfChartVariable struct {
	Name        string
	Description string
	Path        string
}

ZarfChartVariable represents a variable that can be set for Helm chart overrides.

type ZarfContainerTarget

type ZarfContainerTarget struct {
	Namespace string
	Selector  string
	Container string
	Path      string
}

ZarfContainerTarget defines the destination info for a ZarfDataInjection target.

type ZarfDataInjection

type ZarfDataInjection struct {
	Source   string
	Target   ZarfContainerTarget
	Compress bool
}

ZarfDataInjection is a data-injection definition.

Jump to

Keyboard shortcuts

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