v1alpha1

package
v0.28.0 Latest Latest
Warning

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

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

Documentation

Overview

Package v1alpha1 defines file types shared by the cluster and distro APIs.

Index

Constants

View Source
const (
	// APIVersion is the API version string for the zarf.dev v1alpha1 package.
	APIVersion string = "zarf.dev/v1alpha1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinarySelector

type BinarySelector struct {
	// Roles lists the host roles this file applies to.
	Roles []string `json:"roles,omitempty"`
	// Profile selects which host role receives this file: worker or controller.
	Profile string `json:"profile,omitempty" jsonschema:"enum=worker,enum=controller"`
	// Package selects which install method receives this file: rpm, apt, or binary.
	Package string `json:"package,omitempty" jsonschema:"enum=rpm,enum=apt,enum=binary"`
	// Arch lists the CPU architectures this file applies to. An empty list means every architecture the package targets.
	Arch api.Arches `json:"arch,omitempty"`
}

BinarySelector selects which files to upload to a host, based on host role and install method.

func (BinarySelector) MatchesArch

func (s BinarySelector) MatchesArch(arch api.Arch) bool

MatchesArch reports whether this selector applies to arch. An empty Arch list matches every architecture, mirroring how an empty Profile matches every profile.

type LocalFile

type LocalFile struct {
	// Path is the local path to the file cargoship uploads.
	Path string
	// PermMode is the octal permission string cargoship applies to the file.
	PermMode string
}

LocalFile holds the local path and permission cargoship resolves for uploading a file.

type ZarfDistroKind

type ZarfDistroKind string

ZarfDistroKind identifies the kind of a zarf.dev v1alpha1 document, for example ZarfCluster or ZarfDistro.

type ZarfFile

type ZarfFile struct {
	// Data holds the inline file content.
	Data string `json:"data,omitempty"`
	// Executable sets executable permissions on the file when true.
	Executable bool `json:"executable,omitempty"`
	// ExtractPath is the path cargoship extracts from a tarball.
	ExtractPath string `json:"extractPath,omitempty"`
	// Group is the group that owns the file.
	Group string `json:"group,omitempty"`
	// Name identifies the file entry. It is not the file name on disk.
	Name string `json:"name,omitempty"`
	// PermMode sets the permissions cargoship applies to the file. It accepts an octal string or an integer, for example "0644" or 644.
	PermMode any `json:"perm,omitempty"`
	// Selector controls whether cargoship uploads this file to a given node.
	Selector BinarySelector `json:"selector,omitempty"`
	// Shasum verifies the file when cargoship sources the distro package.
	Shasum string `json:"shasum,omitempty"`
	// Source is the path where cargoship finds the file when it creates the package.
	Source string `json:"source"`
	// Symlinks lists the symlinks cargoship creates that point to Target.
	Symlinks []string `json:"symlinks,omitempty"`
	// Target is the path on the remote host where cargoship writes the file.
	Target string `json:"target"`
	// Template renders the file's contents as a Go template against the package's values before cargoship uploads it. It defaults to false, because most files are binaries or archives that a template pass would corrupt.
	Template *bool `json:"template,omitempty"`
	// TargetIsDir indicates that Target is a directory. Cargoship uses this mainly for image uploads.
	TargetIsDir bool `json:"isDirectory,omitempty"`
	// User is the user that owns the file.
	User string `json:"user,omitempty"`
	// Base is the local directory cargoship joins with LocalSource.Path to find the file. Cargoship resolves it at runtime; it is not read from the config.
	Base string `json:"-"`
	// Category labels why cargoship is uploading this file, e.g. "engine", "image", "file", or "data". Cargoship records it in the remote upload manifest; it is not read from the config.
	Category string `json:"-"`
	// PermString is the octal permission string cargoship applies to the file. Cargoship derives it from PermMode at runtime.
	PermString string `json:"-"`
	// DirPermString is the octal permission string cargoship applies to the file's parent directory.
	DirPermString string `json:"-"`
	// OriginalTarget is the target path before cargoship renames it during install. Cargoship uses it to move the file back into place.
	OriginalTarget string `json:"-"`
	// LocalSource holds the resolved local path and permission cargoship uses to upload the file.
	LocalSource LocalFile `json:"-"`
}

ZarfFile defines a file shared by the distro and cluster APIs.

func (*ZarfFile) HasData

func (u *ZarfFile) HasData() bool

HasData reports whether Data holds non-blank content.

func (*ZarfFile) IsTemplate

func (u *ZarfFile) IsTemplate() bool

IsTemplate reports whether this file's contents are rendered against the package's values before upload. Unset means no, so a package that says nothing about templating ships the bytes it was built with.

func (*ZarfFile) Owner

func (u *ZarfFile) Owner() string

Owner returns a chown-compatible "user:group" string built from User and Group. It returns an empty string when both are empty.

func (*ZarfFile) String

func (u *ZarfFile) String() string

String returns Name. If Name is empty, it returns Source instead.

func (*ZarfFile) TargetDirectory

func (u *ZarfFile) TargetDirectory() string

TargetDirectory returns Target if TargetIsDir is true. Otherwise it returns the base name of Target.

func (*ZarfFile) UnmarshalYAML

func (u *ZarfFile) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML unmarshals the YAML data, then converts PermMode into PermString.

type ZarfFiles

type ZarfFiles []*ZarfFile

ZarfFiles is an ordered list of files.

func (ZarfFiles) Filter

func (files ZarfFiles) Filter(filter func(f *ZarfFile) bool) ZarfFiles

Filter returns the files for which filter returns true.

Directories

Path Synopsis
Package cluster defines the API types for a cluster configuration.
Package cluster defines the API types for a cluster configuration.
Package distro defines the API types for a distro package.
Package distro defines the API types for a distro package.

Jump to

Keyboard shortcuts

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