Documentation
¶
Overview ¶
Package v1beta1 holds the definition of the v1beta1 Zarf Package. This API is work in progress and not yet used within Zarf
Index ¶
- Constants
- type Constant
- type GitRepoSource
- type HelmRepoSource
- type InteractiveVariable
- type LocalRepoSource
- type NamespacedObjectKindReference
- type OCISource
- type SetVariable
- type Shell
- type Variable
- type VariableType
- type ZarfBuildData
- type ZarfChart
- type ZarfChartVariable
- type ZarfComponent
- type ZarfComponentAction
- type ZarfComponentActionDefaults
- type ZarfComponentActionSet
- type ZarfComponentActionWait
- type ZarfComponentActionWaitCluster
- type ZarfComponentActionWaitNetwork
- type ZarfComponentActions
- type ZarfComponentImport
- type ZarfComponentOnlyCluster
- type ZarfComponentOnlyTarget
- type ZarfContainerTarget
- type ZarfDataInjection
- type ZarfFile
- type ZarfManifest
- type ZarfMetadata
- type ZarfPackage
- type ZarfPackageKind
Constants ¶
const ( // ZarfInitConfig is the kind of Zarf package used during `zarf init`. ZarfInitConfig ZarfPackageKind = "ZarfInitConfig" // ZarfPackageConfig is the default kind of Zarf package, primarily used during `zarf package`. ZarfPackageConfig ZarfPackageKind = "ZarfPackageConfig" // APIVersion the api version of this package. APIVersion string = "zarf.dev/v1beta1" )
const (
ZarfPackageTemplatePrefix = "###ZARF_PKG_TMPL_"
)
ZarfPackageTemplatePrefix is the prefix for package templates.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constant ¶
type Constant struct {
// The name to be used for the constant
Name string `json:"name" jsonschema:"pattern=^[A-Z0-9_]+$"`
// The value to set for the constant during deploy
Value string `json:"value"`
// A description of the constant to explain its purpose on package create or deploy confirmation prompts
Description string `json:"description,omitempty"`
// Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_CONST_.
AutoIndent bool `json:"autoIndent,omitempty"`
// An optional regex pattern that a constant value must match before a package can be created.
Pattern string `json:"pattern,omitempty"`
}
Constant are constants that can be used to dynamically template K8s resources or run in actions.
type GitRepoSource ¶
type GitRepoSource struct {
// The URL of the git repository where the helm chart is stored.
URL string `json:"url"`
// The sub directory to the chart within a git repo.
Path string `json:"path,omitempty"`
}
GitRepoSource represents a Helm chart stored in a Git repository.
type HelmRepoSource ¶
type HelmRepoSource struct {
// The name of a chart within a Helm repository (defaults to the Zarf name of the chart).
RepoName string `json:"repoName,omitempty"`
// The URL of the chart repository where the helm chart is stored.
URL string `json:"url"`
}
HelmRepoSource represents a Helm chart stored in a Helm repository.
type InteractiveVariable ¶
type InteractiveVariable struct {
Variable `json:",inline"`
// A description of the variable to be used when prompting the user a value
Description string `json:"description,omitempty"`
// The default value to use for the variable
Default string `json:"default,omitempty"`
// Whether to prompt the user for input for this variable
Prompt bool `json:"prompt,omitempty"`
}
InteractiveVariable is a variable that can be used to prompt a user for more information
type LocalRepoSource ¶
type LocalRepoSource struct {
// The path to a local chart's folder or .tgz archive.
Path string `json:"path,omitempty"`
}
LocalRepoSource represents a Helm chart stored locally.
type NamespacedObjectKindReference ¶
type NamespacedObjectKindReference struct {
// API Version of the resource
APIVersion string `json:"apiVersion"`
// Kind of the resource
Kind string `json:"kind"`
// Namespace of the resource
Namespace string `json:"namespace"`
// Name of the resource
Name string `json:"name"`
}
NamespacedObjectKindReference is a reference to a specific resource in a namespace using its kind and API version.
type OCISource ¶
type OCISource struct {
// The URL of the OCI registry where the helm chart is stored.
URL string `json:"url"`
}
OCISource represents a Helm chart stored in an OCI registry.
type SetVariable ¶
type SetVariable struct {
Variable `json:",inline"`
// The value the variable is currently set with
Value string `json:"value"`
}
SetVariable tracks internal variables that have been set during this run of Zarf
type Shell ¶
type Shell struct {
Windows string `` /* 290-byte string literal not displayed */
Linux string `` /* 185-byte string literal not displayed */
Darwin string `` /* 186-byte string literal not displayed */
}
Shell represents the desired shell to use for a given command
type Variable ¶
type Variable struct {
// The name to be used for the variable
Name string `json:"name" jsonschema:"pattern=^[A-Z0-9_]+$"`
// Whether to mark this variable as sensitive to not print it in the log
Sensitive bool `json:"sensitive,omitempty"`
// Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_VAR_.
AutoIndent bool `json:"autoIndent,omitempty"`
// An optional regex pattern that a variable value must match before a package deployment can continue.
Pattern string `json:"pattern,omitempty"`
// Changes the handling of a variable to load contents differently (i.e. from a file rather than as a raw variable - templated files should be kept below 1 MiB)
Type VariableType `json:"type,omitempty" jsonschema:"enum=raw,enum=file"`
}
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 is a type for a Zarf package variable that loads its contents from a file FileVariableType VariableType = "file" )
type ZarfBuildData ¶
type ZarfBuildData struct {
// Checksum of a checksums.txt file that contains checksums all the layers within the package.
AggregateChecksum string `json:"aggregateChecksum,omitempty"`
// The machine name that created this package.
Terminal string `json:"terminal,omitempty"`
// The username who created this package.
User string `json:"user,omitempty"`
// The architecture this package was created on.
Architecture string `json:"architecture"`
// The timestamp when this package was created.
Timestamp string `json:"timestamp"`
// The version of Zarf used to build this package.
Version string `json:"version"`
// Any migrations that have been run on this package.
Migrations []string `json:"migrations,omitempty"`
// Any registry domains that were overridden on package create when pulling images.
RegistryOverrides map[string]string `json:"registryOverrides,omitempty"`
// Whether this package was created with differential components.
Differential bool `json:"differential,omitempty"`
// Version of a previously built package used as the basis for creating this differential package.
DifferentialPackageVersion string `json:"differentialPackageVersion,omitempty"`
// List of components that were not included in this package due to differential packaging.
DifferentialMissing []string `json:"differentialMissing,omitempty"`
// The minimum version of Zarf that does not have breaking package structure changes.
LastNonBreakingVersion string `json:"lastNonBreakingVersion,omitempty"`
// The flavor of Zarf used to build this package.
Flavor string `json:"flavor,omitempty"`
}
ZarfBuildData is written during the packager.Create() operation to track details of the created package.
type ZarfChart ¶
type ZarfChart struct {
// The name of the chart within Zarf; note that this must be unique and does not need to be the same as the name in the chart repo.
Name string `json:"name"`
// The Helm repo where the chart is stored
Helm HelmRepoSource `json:"helm,omitempty"`
// The Git repo where the chart is stored
Git GitRepoSource `json:"git,omitempty"`
// The local path where the chart is stored
Local LocalRepoSource `json:"local,omitempty"`
// The OCI registry where the chart is stored
OCI OCISource `json:"oci,omitempty"`
// The version of the chart to deploy; for git-based charts this is also the tag of the git repo by default (when not using the '@' syntax for 'repos').
Version string `json:"version,omitempty"`
// The namespace to deploy the chart to.
Namespace string `json:"namespace,omitempty"`
// The name of the Helm release to create (defaults to the Zarf name of the chart).
ReleaseName string `json:"releaseName,omitempty"`
// Whether to not wait for chart resources to be ready before continuing.
Wait *bool `json:"wait,omitempty"`
// List of local values file paths or remote URLs to include in the package; these will be merged together when deployed.
ValuesFiles []string `json:"valuesFiles,omitempty"`
// [alpha] List of variables to set in the Helm chart.
Variables []ZarfChartVariable `json:"variables,omitempty"`
}
ZarfChart defines a helm chart to be deployed.
type ZarfChartVariable ¶
type ZarfChartVariable struct {
// The name of the variable.
Name string `json:"name" jsonschema:"pattern=^[A-Z0-9_]+$"`
// A brief description of what the variable controls.
Description string `json:"description"`
// The path within the Helm chart values where this variable applies.
Path string `json:"path"`
}
ZarfChartVariable represents a variable that can be set for a Helm chart overrides.
type ZarfComponent ¶
type ZarfComponent struct {
// The name of the component.
Name string `json:"name" jsonschema:"pattern=^[a-z0-9][a-z0-9\\-]*$"`
// Message to include during package deploy describing the purpose of this component.
Description string `json:"description,omitempty"`
// Determines the default Y/N state for installing this component on package deploy.
Default bool `json:"default,omitempty"`
// Do not prompt user to install this component. (Defaults to false)
Optional *bool `json:"optional,omitempty"`
// Filter when this component is included in package creation or deployment.
Only ZarfComponentOnlyTarget `json:"only,omitempty"`
// Import a component from another Zarf package.
Import ZarfComponentImport `json:"import,omitempty"`
// Kubernetes manifests to be included in a generated Helm chart on package deploy.
Manifests []ZarfManifest `json:"manifests,omitempty"`
// Helm charts to install during package deploy.
Charts []ZarfChart `json:"charts,omitempty"`
// Datasets to inject into a container in the target cluster.
DataInjections []ZarfDataInjection `json:"dataInjections,omitempty"`
// Files or folders to place on disk during package deployment.
Files []ZarfFile `json:"files,omitempty"`
// List of OCI images to include in the package.
Images []string `json:"images,omitempty"`
// List of git repos to include in the package.
Repos []string `json:"repos,omitempty"`
// Custom commands to run at various stages of a package lifecycle.
Actions ZarfComponentActions `json:"actions,omitempty"`
// List of resources to health check after deployment
HealthChecks []NamespacedObjectKindReference `json:"healthChecks,omitempty"`
}
ZarfComponent is the primary functional grouping of assets to deploy by Zarf.
func (ZarfComponent) IsOptional ¶
func (c ZarfComponent) IsOptional() bool
IsOptional returns if the component is optional.
func (ZarfComponent) RequiresCluster ¶
func (c ZarfComponent) RequiresCluster() bool
RequiresCluster returns if the component requires a cluster connection to deploy.
type ZarfComponentAction ¶
type ZarfComponentAction struct {
// Hide the output of the command during package deployment (default false).
Mute *bool `json:"mute,omitempty"`
// Timeout in seconds for the command (default to 0, no timeout for cmd actions and 5 minutes for wait actions).
Timeout *metav1.Duration `json:"timeout,omitempty"`
// Retry the command if it fails up to given number of times (default 0).
Retries int `json:"retries,omitempty"`
// The working directory to run the command in (default is CWD).
Dir *string `json:"dir,omitempty"`
// Additional environment variables to set for the command.
Env []string `json:"env,omitempty"`
// The command to run. Must specify either cmd or wait for the action to do anything.
Cmd string `json:"cmd,omitempty"`
// (cmd only) Indicates a preference for a shell for the provided cmd to be executed in on supported operating systems.
Shell *Shell `json:"shell,omitempty"`
// (onDeploy/cmd only) An array of variables to update with the output of the command. These variables will be available to all remaining actions and components in the package.
SetVariables []Variable `json:"setVariables,omitempty"`
// Description of the action to be displayed during package execution instead of the command.
Description string `json:"description,omitempty"`
// Wait for a condition to be met before continuing. Must specify either cmd or wait for the action. See the 'zarf tools wait-for' command for more info.
Wait *ZarfComponentActionWait `json:"wait,omitempty"`
}
ZarfComponentAction represents a single action to run during a zarf package operation.
type ZarfComponentActionDefaults ¶
type ZarfComponentActionDefaults struct {
// Hide the output of commands during execution (default false).
Mute bool `json:"mute,omitempty"`
// Default timeout in seconds for commands (default no timeout).
Timeout *metav1.Duration `json:"timeout,omitempty"`
// Retry commands given number of times if they fail (default 0).
Retries int `json:"retries,omitempty"`
// Working directory for commands (default CWD).
Dir string `json:"dir,omitempty"`
// Additional environment variables for commands.
Env []string `json:"env,omitempty"`
// (cmd only) Indicates a preference for a shell for the provided cmd to be executed in on supported operating systems.
Shell Shell `json:"shell,omitempty"`
}
ZarfComponentActionDefaults sets the default configs for child actions.
type ZarfComponentActionSet ¶
type ZarfComponentActionSet struct {
// Default configuration for all actions in this set.
Defaults ZarfComponentActionDefaults `json:"defaults,omitempty"`
// Actions to run at the start of an operation.
Before []ZarfComponentAction `json:"before,omitempty"`
// Actions to run at the end of an operation.
After []ZarfComponentAction `json:"after,omitempty"`
// Actions to run if all operations succeed.
OnSuccess []ZarfComponentAction `json:"onSuccess,omitempty"`
// Actions to run if all operations fail.
OnFailure []ZarfComponentAction `json:"onFailure,omitempty"`
}
ZarfComponentActionSet is a set of actions to run during a zarf package operation.
type ZarfComponentActionWait ¶
type ZarfComponentActionWait struct {
// Wait for a condition to be met in the cluster before continuing. Only one of cluster or network can be specified.
Cluster *ZarfComponentActionWaitCluster `json:"cluster,omitempty"`
// Wait for a condition to be met on the network before continuing. Only one of cluster or network can be specified.
Network *ZarfComponentActionWaitNetwork `json:"network,omitempty"`
}
ZarfComponentActionWait specifies a condition to wait for before continuing
type ZarfComponentActionWaitCluster ¶
type ZarfComponentActionWaitCluster struct {
// The kind of resource to wait for.
Kind string `json:"kind" jsonschema:"example=Pod,example=Deployment"`
// The name of the resource or selector to wait for.
Name string `json:"name" jsonschema:"example=podinfo,example=app=podinfo"`
// The namespace of the resource to wait for.
Namespace string `json:"namespace,omitempty"`
// The condition or jsonpath state to wait for; defaults to exist, a special condition that will wait for the resource to exist.
Condition string `json:"condition,omitempty" jsonschema:"example=Ready,example=Available,'{.status.availableReplicas}'=23"`
}
ZarfComponentActionWaitCluster specifies a condition to wait for before continuing
type ZarfComponentActionWaitNetwork ¶
type ZarfComponentActionWaitNetwork struct {
// The protocol to wait for.
Protocol string `json:"protocol" jsonschema:"enum=tcp,enum=http,enum=https"`
// The address to wait for.
Address string `json:"address" jsonschema:"example=localhost:8080,example=1.1.1.1"`
// The HTTP status code to wait for if using http or https.
Code int `json:"code,omitempty" jsonschema:"example=200,example=404"`
}
ZarfComponentActionWaitNetwork specifies a condition to wait for before continuing
type ZarfComponentActions ¶
type ZarfComponentActions struct {
// Actions to run during package creation.
OnCreate ZarfComponentActionSet `json:"onCreate,omitempty"`
// Actions to run during package deployment.
OnDeploy ZarfComponentActionSet `json:"onDeploy,omitempty"`
// Actions to run during package removal.
OnRemove ZarfComponentActionSet `json:"onRemove,omitempty"`
}
ZarfComponentActions are ActionSets that map to different zarf package operations.
type ZarfComponentImport ¶
type ZarfComponentImport struct {
// The name of the component to import from the referenced zarf.yaml.
Name string `json:"name,omitempty"`
// The path to the directory containing the zarf.yaml to import.
Path string `json:"path,omitempty"`
// [beta] The URL to a Zarf package to import via OCI.
URL string `json:"url,omitempty" jsonschema:"pattern=^oci://.*$"`
}
ZarfComponentImport structure for including imported Zarf components.
type ZarfComponentOnlyCluster ¶
type ZarfComponentOnlyCluster struct {
// Only create and deploy to clusters of the given architecture.
Architecture string `json:"architecture,omitempty" jsonschema:"enum=amd64,enum=arm64"`
// A list of kubernetes distros this package works with (Reserved for future use).
Distros []string `json:"distros,omitempty" jsonschema:"example=k3s,example=eks"`
}
ZarfComponentOnlyCluster represents the architecture and K8s cluster distribution to filter on.
type ZarfComponentOnlyTarget ¶
type ZarfComponentOnlyTarget struct {
// Only deploy component to specified OS.
LocalOS string `json:"localOS,omitempty" jsonschema:"enum=linux,enum=darwin,enum=windows"`
// Only deploy component to specified clusters.
Cluster ZarfComponentOnlyCluster `json:"cluster,omitempty"`
// Only include this component when a matching '--flavor' is specified on 'zarf package create'.
Flavor string `json:"flavor,omitempty"`
}
ZarfComponentOnlyTarget filters a component to only show it for a given local OS and cluster.
type ZarfContainerTarget ¶
type ZarfContainerTarget struct {
// The namespace to target for data injection.
Namespace string `json:"namespace"`
// The K8s selector to target for data injection.
Selector string `json:"selector" jsonschema:"example=app=data-injection"`
// The container name to target for data injection.
Container string `json:"container"`
// The path within the container to copy the data into.
Path string `json:"path"`
}
ZarfContainerTarget defines the destination info for a ZarfData target
type ZarfDataInjection ¶
type ZarfDataInjection struct {
// Either a path to a local folder/file or a remote URL of a file to inject into the given target pod + container.
Source string `json:"source"`
// The target pod + container to inject the data into.
Target ZarfContainerTarget `json:"target"`
// Compress the data before transmitting using gzip. Note: this requires support for tar/gzip locally and in the target image.
Compress bool `json:"compress,omitempty"`
}
ZarfDataInjection is a data-injection definition.
type ZarfFile ¶
type ZarfFile struct {
// Local folder or file path or remote URL to pull into the package.
Source string `json:"source"`
// (files only) Optional SHA256 checksum of the file.
Shasum string `json:"shasum,omitempty"`
// The absolute or relative path where the file or folder should be copied to during package deploy.
Target string `json:"target"`
// (files only) Determines if the file should be made executable during package deploy.
Executable bool `json:"executable,omitempty"`
// List of symlinks to create during package deploy.
Symlinks []string `json:"symlinks,omitempty"`
// Local folder or file to be extracted from a 'source' archive.
ExtractPath string `json:"extractPath,omitempty"`
}
ZarfFile defines a file to deploy.
type ZarfManifest ¶
type ZarfManifest struct {
// A name to give this collection of manifests; this will become the name of the dynamically-created helm chart.
Name string `json:"name"`
// The namespace to deploy the manifests to.
Namespace string `json:"namespace,omitempty"`
// List of local K8s YAML files or remote URLs to deploy (in order).
Files []string `json:"files,omitempty"`
// Allow traversing directory above the current directory if needed for kustomization. (Defaults to false)
KustomizeAllowAnyDirectory bool `json:"kustomizeAllowAnyDirectory,omitempty"`
// List of local kustomization paths or remote URLs to include in the package.
Kustomizations []string `json:"kustomizations,omitempty"`
// Whether to not wait for manifest resources to be ready before continuing. (Defaults to true)
Wait *bool `json:"wait,omitempty"`
}
ZarfManifest defines raw manifests Zarf will deploy as a helm chart.
type ZarfMetadata ¶
type ZarfMetadata struct {
// Name to identify this Zarf package.
Name string `json:"name" jsonschema:"pattern=^[a-z0-9][a-z0-9\\-]*$"`
// Generic string set by a package author to track the package version (Note: ZarfInitConfigs will always be versioned to the CLIVersion they were created with).
Version string `json:"version,omitempty"`
// Disable compression of this package.
Uncompressed bool `json:"uncompressed,omitempty"`
// The target cluster architecture for this package.
Architecture string `json:"architecture,omitempty" jsonschema:"example=arm64,example=amd64"`
// Default to true, when false components cannot have images or git repos as they will be pulled from the internet
Airgap *bool `json:"airgap,omitempty"`
// Annotations are key-value pairs that can be used to store metadata about the package.
Annotations map[string]string `json:"annotations,omitempty"`
}
ZarfMetadata lists information about the current ZarfPackage.
type ZarfPackage ¶
type ZarfPackage struct {
// The API version of the Zarf package.
APIVersion string `json:"apiVersion,omitempty," jsonschema:"enum=zarf.dev/v1beta1"`
// The kind of Zarf package.
Kind ZarfPackageKind `json:"kind" jsonschema:"enum=ZarfInitConfig,enum=ZarfPackageConfig,default=ZarfPackageConfig"`
// Package metadata.
Metadata ZarfMetadata `json:"metadata,omitempty"`
// Zarf-generated package build data.
Build ZarfBuildData `json:"build,omitempty"`
// List of components to deploy in this package.
Components []ZarfComponent `json:"components" jsonschema:"minItems=1"`
// Constant template values applied on deploy for K8s resources.
Constants []Constant `json:"constants,omitempty"`
// Variable template values applied on deploy for K8s resources.
Variables []InteractiveVariable `json:"variables,omitempty"`
}
ZarfPackage the top-level structure of a Zarf config file.
func TranslateAlphaPackage ¶
func TranslateAlphaPackage(alphaPkg v1alpha1.ZarfPackage) (ZarfPackage, error)
TranslateAlphaPackage translates a v1alpha1.ZarfPackage to a v1beta1.ZarfPackage
func (ZarfPackage) HasImages ¶
func (pkg ZarfPackage) HasImages() bool
HasImages returns true if one of the components contains an image.
func (ZarfPackage) IsInitConfig ¶
func (pkg ZarfPackage) IsInitConfig() bool
IsInitConfig returns whether a Zarf package is an init config.
func (ZarfPackage) IsSBOMAble ¶
func (pkg ZarfPackage) IsSBOMAble() bool
IsSBOMAble checks if a package has contents that an SBOM can be created on (i.e. images, files, or data injections).
type ZarfPackageKind ¶
type ZarfPackageKind string
ZarfPackageKind is an enum of the different kinds of Zarf packages.