Documentation
¶
Overview ¶
Package packager contains high level operations for Zarf packages
Index ¶
- func Create(ctx context.Context, packagePath string, output string, opts CreateOptions) (_ string, err error)
- func DevDeploy(ctx context.Context, packagePath string, opts DevDeployOptions) (err error)
- func Generate(ctx context.Context, packageName, url, version string, opts GenerateOptions) (pkg v1alpha1.ZarfPackage, err error)
- func GetPackageFromSourceOrCluster(ctx context.Context, cluster *cluster.Cluster, src string, ...) (_ v1alpha1.ZarfPackage, err error)
- func Lint(ctx context.Context, packagePath string, opts LintOptions) error
- func LoadPackage(ctx context.Context, source string, opts LoadOptions) (_ *layout.PackageLayout, err error)
- func OverridePackageNamespace(pkg *v1alpha1.ZarfPackage, namespace string) error
- func PackageDigest(ctx context.Context, source string, opts PackageDigestOptions) (string, error)
- func PublishFromOCI(ctx context.Context, src registry.Reference, dst registry.Reference, ...) (err error)
- func PublishPackage(ctx context.Context, pkgLayout *layout.PackageLayout, dst registry.Reference, ...) (registry.Reference, error)
- func PublishSkeleton(ctx context.Context, path string, ref registry.Reference, ...) (registry.Reference, error)
- func Pull(ctx context.Context, source, destination string, opts PullOptions) (_ string, err error)
- func PushImagesToRegistry(ctx context.Context, pkgLayout *layout.PackageLayout, ...) error
- func PushReposToRepository(ctx context.Context, pkgLayout *layout.PackageLayout, ...) error
- func Remove(ctx context.Context, pkg v1alpha1.ZarfPackage, opts RemoveOptions) error
- func UpdateImages(ctx context.Context, packagePath string, ...) error
- func UpdateSchema(ctx context.Context, packagePath string, schemaFilename string) error
- type ComponentImageScan
- type CreateOptions
- type DefinitionImageResult
- type DeployOptions
- type DeployResult
- type DevDeployOptions
- type FindImagesOptions
- type GenerateOptions
- type ImagePushOptions
- type InspectDefinitionResourcesOptions
- type InspectPackageResourcesOptions
- type LintOptions
- type LoadOptions
- type PackageDigestOptions
- type PublishFromOCIOptions
- type PublishPackageOptions
- type PublishSkeletonOptions
- type PullOptions
- type RemoveOptions
- type RepoPushOptions
- type Resource
- type ResourceType
- type ValuesOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶ added in v0.56.0
func Create(ctx context.Context, packagePath string, output string, opts CreateOptions) (_ string, err error)
Create takes a path to a directory containing a ZarfPackageConfig and returns the path to the created package
func DevDeploy ¶ added in v0.56.0
func DevDeploy(ctx context.Context, packagePath string, opts DevDeployOptions) (err error)
DevDeploy creates + deploys a package in one shot
func Generate ¶ added in v0.56.0
func Generate(ctx context.Context, packageName, url, version string, opts GenerateOptions) (pkg v1alpha1.ZarfPackage, err error)
Generate a Zarf package definition using information about a Helm chart.
func GetPackageFromSourceOrCluster ¶ added in v0.56.0
func GetPackageFromSourceOrCluster(ctx context.Context, cluster *cluster.Cluster, src string, namespaceOverride string, opts LoadOptions) (_ v1alpha1.ZarfPackage, err error)
GetPackageFromSourceOrCluster retrieves a Zarf package from a source or cluster.
func Lint ¶ added in v0.56.0
func Lint(ctx context.Context, packagePath string, opts LintOptions) error
Lint lints the given Zarf package
func LoadPackage ¶ added in v0.56.0
func LoadPackage(ctx context.Context, source string, opts LoadOptions) (_ *layout.PackageLayout, err error)
LoadPackage fetches, verifies, and loads a Zarf package from the specified source.
func OverridePackageNamespace ¶ added in v0.57.0
func OverridePackageNamespace(pkg *v1alpha1.ZarfPackage, namespace string) error
OverridePackageNamespace overrides the package namespace if the package contains only one unique namespace
func PackageDigest ¶ added in v0.80.0
PackageDigest returns the SHA256 OCI manifest digest for the given package source. For OCI sources the digest is resolved directly from the registry without downloading the package. For local tarballs the manifest is computed deterministically from the package contents, producing the same digest that would result from publishing with PushPackage.
func PublishFromOCI ¶ added in v0.56.0
func PublishFromOCI(ctx context.Context, src registry.Reference, dst registry.Reference, opts PublishFromOCIOptions) (err error)
PublishFromOCI takes a source and destination registry reference and a PublishFromOCIOpts and copies the package from the source to the destination. src and dst are references to the full package ref, e.g. my-registry.com/my-namespace/my-package:0.0.1 therefore any tag manipulation happens from the calling logic
func PublishPackage ¶ added in v0.56.0
func PublishPackage(ctx context.Context, pkgLayout *layout.PackageLayout, dst registry.Reference, opts PublishPackageOptions) (registry.Reference, error)
PublishPackage takes a package layout and pushes the package to the given registry. dst is the path to the registry namespace, e.g. my-registry.com/my-namespace. The full package ref is created using the package name and returned
func PublishSkeleton ¶ added in v0.56.0
func PublishSkeleton(ctx context.Context, path string, ref registry.Reference, opts PublishSkeletonOptions) (registry.Reference, error)
PublishSkeleton takes a Path to the package definition and uploads a skeleton package to the given a registry. dst is the path to the registry namespace, e.g. my-registry.com/my-namespace. The full package ref is created using the package name and returned
func Pull ¶ added in v0.55.0
Pull takes a source URL and destination directory, fetches the Zarf package from the given sources, and returns the path to the fetched package.
func PushImagesToRegistry ¶ added in v0.56.0
func PushImagesToRegistry(ctx context.Context, pkgLayout *layout.PackageLayout, registryInfo state.RegistryInfo, opts ImagePushOptions) error
PushImagesToRegistry pushes images in the package layout to the specified registry
func PushReposToRepository ¶ added in v0.56.0
func PushReposToRepository(ctx context.Context, pkgLayout *layout.PackageLayout, gitInfo state.GitServerInfo, opts RepoPushOptions) error
PushReposToRepository pushes Git repositories in the package layout to the Git server
func Remove ¶ added in v0.56.0
func Remove(ctx context.Context, pkg v1alpha1.ZarfPackage, opts RemoveOptions) error
Remove removes a package that was already deployed onto a cluster, uninstalling all installed helm charts.
func UpdateImages ¶ added in v0.66.0
func UpdateImages(ctx context.Context, packagePath string, definitionImageResults []DefinitionImageResult) error
UpdateImages updates the images field for components in a zarf.yaml.
Types ¶
type ComponentImageScan ¶ added in v0.56.0
type ComponentImageScan struct {
// ComponentName is the name of the component where the images were found
ComponentName string
// Matches contains definitively identified container images, such as those in an image: field
Matches []string
// PotentialMatches contains potential container images found by a regex
PotentialMatches []string
// CosignArtifacts contains found cosign artifacts for images
CosignArtifacts []string
// WhyResources contains the resources where specific images were found (when Why option is used)
WhyResources []Resource
}
ComponentImageScan contains the results of FindImages for a component
func FindImages ¶ added in v0.56.0
func FindImages(ctx context.Context, packagePath string, opts FindImagesOptions) (_ []ComponentImageScan, err error)
FindImages iterates over the manifests and charts within each component to find any container images It returns []ComponentImageScan which contains a scan result for each component
type CreateOptions ¶ added in v0.56.0
type CreateOptions struct {
Flavor string
RegistryOverrides []images.RegistryOverride
SigningKeyPath string
SigningKeyPassword string
SetVariables map[string]string
MaxPackageSizeMB int
SBOMOut string
SkipSBOM bool
DifferentialPackagePath string
OCIConcurrency int
CachePath string
WithBuildMachineInfo bool
// applicable when output is an OCI registry
types.RemoteOptions
// IsInteractive decides if Zarf can interactively prompt users through the CLI
IsInteractive bool
// SkipVersionCheck skips version requirement validation
SkipVersionCheck bool
}
CreateOptions are the optional parameters to create
type DefinitionImageResult ¶ added in v0.77.0
type DefinitionImageResult struct {
ComponentImageScan
ImageArchives []v1alpha1.ImageArchive
}
DefinitionImageResult contains the results of FindDefinitionImages for a component
func FindDefinitionImages ¶ added in v0.77.0
func FindDefinitionImages(ctx context.Context, packagePath string, opts FindImagesOptions) ([]DefinitionImageResult, error)
FindDefinitionImages finds all images contained in a component and filters them according to images discovered in imageArchives. It returns []DefinitionImageResult
type DeployOptions ¶ added in v0.56.0
type DeployOptions struct {
// Deploy time set variables
SetVariables map[string]string
// Values are values passed in at deploy time. They can come from the CLI, user configuration, or set directly by
// API callers.
value.Values
// Whether to adopt any pre-existing K8s resources into the Helm charts managed by Zarf
AdoptExistingResources bool
// Connected deploys without mirroring images/repos and labels resources to bypass the Zarf agent
Connected bool
// Force Helm to take ownership of conflicting fields during Server-Side Apply operations
ForceConflicts bool
// Timeout for Helm operations
Timeout time.Duration
// Retries to preform for operations like git and image pushes
Retries int
// Number of layers to push concurrently per image
OCIConcurrency int
// Namespace is an optional namespace override for package deployment
NamespaceOverride string
// Remote Options for image pushes
types.RemoteOptions
// How to configure Zarf state if it's not already been configured
GitServer state.GitServerInfo
RegistryInfo state.RegistryInfo
ArtifactServer state.ArtifactServerInfo
StorageClass string
InjectorPort int
// AgentTLS allows providing user-managed TLS certificates for the agent. When nil, certs are auto-generated.
AgentTLS *pki.GeneratedPKI
// AgentMutationPolicy controls whether the agent mutates by default (default-mutate) or only on explicit label (default-ignore).
AgentMutationPolicy state.MutationPolicy
// [Library Only] A map of component names to chart names containing Helm Chart values to override values on deploy
ValuesOverridesMap ValuesOverrides
// IsInteractive decides if Zarf can interactively prompt users through the CLI
IsInteractive bool
// SkipVersionCheck skips version requirement validation
SkipVersionCheck bool
}
DeployOptions are optional parameters to packager.Deploy
type DeployResult ¶ added in v0.58.0
type DeployResult struct {
DeployedComponents []state.DeployedComponent
VariableConfig *variables.VariableConfig
Values value.Values
}
DeployResult is the result of a successful deploy
func Deploy ¶ added in v0.56.0
func Deploy(ctx context.Context, pkgLayout *layout.PackageLayout, opts DeployOptions) (DeployResult, error)
Deploy takes a reference to a `layout.PackageLayout` and deploys the package. If successful, returns a list of components that were successfully deployed and the associated variable config.
type DevDeployOptions ¶ added in v0.56.0
type DevDeployOptions struct {
// When true packs images and repos into the package and uses the cluster Zarf state
// When false deploys package without repos or images and uses the default Zarf state
AirgapMode bool
// Flavor causes the package to only include components with a matching `.components[x].only.flavor` or no flavor `.components[x].only.flavor` specified
Flavor string
// RegistryURL allows for an override to the Zarf state registry URL when not in airgap mode. Important for setting the ###ZARF_REGISTRY### template
RegistryURL string
// RegistryOverrides overrides the basepath of an OCI image with a path to a different registry during package assembly
RegistryOverrides []images.RegistryOverride
// CreateSetVariables are for package templates
CreateSetVariables map[string]string
// DeploySetVariables are for package variables
DeploySetVariables map[string]string
// OptionalComponents to be deployed
OptionalComponents string
// Timeout for Helm operations
Timeout time.Duration
// Retries to preform for operations like git and image pushes
Retries int
// These fields are only used if in airgap mode as they are relevant to requests from the git-server / registry
OCIConcurrency int
CachePath string
// SkipVersionCheck skips version requirement validation
SkipVersionCheck bool
types.RemoteOptions
}
DevDeployOptions are the optionalParameters to DevDeploy
type FindImagesOptions ¶ added in v0.56.0
type FindImagesOptions struct {
// RepoHelmChartPath specifies the path to helm charts in git repos defined in the zarf.yaml
RepoHelmChartPath string
// RegistryURL specifies the value of the ###ZARF_REGISTRY### variable during templating
RegistryURL string
// KubeVersionOverride specifies the kubernetes version to provide the Helm chart
KubeVersionOverride string
// CreateSetVariables specifies the package create templates
CreateSetVariables map[string]string
// DeploySetVariables specifies the package deploy variables
DeploySetVariables map[string]string
// Values are values passed in at find-images time. They can come from the CLI, user configuration, or set directly
// by API callers.
Values value.Values
// Flavor specifies the flavor to use
Flavor string
// Why specifies the image to look for so we can print the containing manifest
Why string
// SkipCosign specifies whether to skip cosign artifact lookups
SkipCosign bool
// CachePath is used to cache layers from skeleton package pulls
CachePath string
// IsInteractive decides if Zarf can interactively prompt users through the CLI
IsInteractive bool
types.RemoteOptions
}
FindImagesOptions declares the parameters to find images.
type GenerateOptions ¶ added in v0.56.0
type GenerateOptions struct {
// Path to the Helm chart in the git repository
GitPath string
// Kube version to provide to the Helm chart
KubeVersion string
}
GenerateOptions are the options for generating a Zarf package.
type ImagePushOptions ¶ added in v0.56.0
type ImagePushOptions struct {
Cluster *cluster.Cluster
NoImageChecksum bool
Retries int
OCIConcurrency int
types.RemoteOptions
}
ImagePushOptions are optional parameters to push images in a zarf package to a registry
type InspectDefinitionResourcesOptions ¶ added in v0.56.0
type InspectDefinitionResourcesOptions struct {
CreateSetVariables map[string]string
DeploySetVariables map[string]string
// Values are values passed in at inspect time. They can come from the CLI, user configuration, or set directly by
// API callers.
Values value.Values
Flavor string
KubeVersion string
// CachePath is used to cache layers from skeleton package pulls
CachePath string
// IsInteractive decides if Zarf can interactively prompt users through the CLI
IsInteractive bool
types.RemoteOptions
}
InspectDefinitionResourcesOptions are the optional parameters to InspectDefinitionResources
type InspectPackageResourcesOptions ¶ added in v0.56.0
type InspectPackageResourcesOptions struct {
SetVariables map[string]string
// Values merge on top of the package's values.yaml and feed chart overrides and manifest Go-templates.
Values value.Values
KubeVersion string
// IsInteractive decides if Zarf can interactively prompt users through the CLI
IsInteractive bool
types.RemoteOptions
}
InspectPackageResourcesOptions are the optional parameters to InspectPackageResources
type LintOptions ¶ added in v0.56.0
type LintOptions struct {
SetVariables map[string]string
Flavor string
CachePath string
types.RemoteOptions
}
LintOptions are the optional parameters to Lint
type LoadOptions ¶ added in v0.56.0
type LoadOptions struct {
Shasum string
Architecture string
// Deprecated: Use VerifyBlobOptions instead.
PublicKeyPath string
VerifyBlobOptions *signing.VerifyBlobOptions
Filter filters.ComponentFilterStrategy
Output string
// number of layers to pull in parallel
OCIConcurrency int
// LayerTypes specifies which layer types to pull from OCI
LayerTypes []zoci.LayerType
// CachePath is used to cache layers from OCI package pulls
CachePath string
// Connected skips pulling image layers from OCI sources
Connected bool
// Only applicable to OCI + HTTP
types.RemoteOptions
// VerificationStrategy for explicit definition
layout.VerificationStrategy
}
LoadOptions are the options for LoadPackage.
type PackageDigestOptions ¶ added in v0.80.0
type PackageDigestOptions struct {
Architecture string
RemoteOptions types.RemoteOptions
// Cluster is required when the source is a deployed package name (cluster source).
Cluster *cluster.Cluster
// NamespaceOverride is the namespace override used when the package was deployed,
// required to locate the correct secret for cluster sources.
NamespaceOverride string
}
PackageDigestOptions are the options for PackageDigest.
type PublishFromOCIOptions ¶ added in v0.56.0
type PublishFromOCIOptions struct {
// OCIConcurrency configures the amount of layers to push in parallel
OCIConcurrency int
// Architecture is the architecture we are publishing to
Architecture string
// Retries is the number of times to retry a failed push
Retries int
types.RemoteOptions
}
PublishFromOCIOptions declares the parameters to publish a package.
type PublishPackageOptions ¶ added in v0.56.0
type PublishPackageOptions struct {
// OCIConcurrency configures the amount of layers to push in parallel
OCIConcurrency int
// SignBlobOptions holds all signing configuration. Use signing.DefaultSignBlobOptions() as a base.
SignBlobOptions signing.SignBlobOptions
// Retries specifies the number of retries to use
Retries int
types.RemoteOptions
// Tag is an optional tag for the OCI reference separate from the package metadata.version
Tag string
// Deprecated: populate SignBlobOptions.Key directly.
SigningKeyPath string
// Deprecated: populate SignBlobOptions.Password directly.
SigningKeyPassword string
}
PublishPackageOptions declares the parameters to publish a package.
type PublishSkeletonOptions ¶ added in v0.56.0
type PublishSkeletonOptions struct {
// OCIConcurrency configures the amount of layers to push in parallel
OCIConcurrency int
// SigningKeyPath points to a signing key on the local disk.
SigningKeyPath string
// SigningKeyPassword holds a password to use the key at SigningKeyPath.
SigningKeyPassword string
// CachePath is used to cache layers from skeleton package pulls
CachePath string
// Flavor specifies the flavor to use
Flavor string
// Retries specifies the number of retries to use
Retries int
// SkipVersionCheck skips version requirement validation
SkipVersionCheck bool
// WithBuildMachineInfo controls whether to include build machine information (hostname and username) in the package metadata
WithBuildMachineInfo bool
types.RemoteOptions
// Tag is an optional tag for the OCI reference separate from the package metadata.version
Tag string
}
PublishSkeletonOptions declares the parameters to publish a skeleton package.
type PullOptions ¶ added in v0.55.0
type PullOptions struct {
// SHASum uniquely identifies a package based on its contents.
SHASum string
// Architecture is the package architecture.
Architecture string
// Deprecated: Use VerifyBlobOptions instead. PublicKeyPath validates the create-time signage of a package.
PublicKeyPath string
// VerifyBlobOptions configures package signature verification.
VerifyBlobOptions *signing.VerifyBlobOptions
// OCIConcurrency is the number of layers pulled in parallel
OCIConcurrency int
// CachePath is used to cache layers from OCI package pulls
CachePath string
types.RemoteOptions
// VerificationStrategy for explicit definition
layout.VerificationStrategy
}
PullOptions declares optional configuration for a Pull operation.
type RemoveOptions ¶ added in v0.56.0
type RemoveOptions struct {
Cluster *cluster.Cluster
Timeout time.Duration
NamespaceOverride string
SkipVersionCheck bool
// Values passed in at remove time. They can come from the CLI or set directly by API callers.
value.Values
}
RemoveOptions are the options for Remove.
type RepoPushOptions ¶ added in v0.56.0
RepoPushOptions are optional parameters to push repos in a zarf package to a Git server
type Resource ¶ added in v0.56.0
type Resource struct {
Content string
Name string
ResourceType ResourceType
}
Resource contains a Kubernetes Manifest or Chart
func InspectDefinitionResources ¶ added in v0.56.0
func InspectDefinitionResources(ctx context.Context, packagePath string, opts InspectDefinitionResourcesOptions) (_ []Resource, err error)
InspectDefinitionResources templates and returns the manifests and Helm chart manifests found in the definition at the given path
func InspectPackageResources ¶ added in v0.56.0
func InspectPackageResources(ctx context.Context, pkgLayout *layout.PackageLayout, opts InspectPackageResourcesOptions) (_ []Resource, err error)
InspectPackageResources templates and returns the manifests, charts, and values files in the package as they would be on deploy
type ResourceType ¶ added in v0.56.0
type ResourceType string
ResourceType represents the different types of Zarf resources that can be inspected
const ( ManifestResource ResourceType = "manifest" ChartResource ResourceType = "chart" ValuesFileResource ResourceType = "valuesfile" )
The different types of resources that can be inspected
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package actions contains functions for running component actions within Zarf packages.
|
Package actions contains functions for running component actions within Zarf packages. |
|
Package filters contains core implementations of the ComponentFilterStrategy interface.
|
Package filters contains core implementations of the ComponentFilterStrategy interface. |
|
Package layout contains functions for interacting with Zarf packages.
|
Package layout contains functions for interacting with Zarf packages. |
|
Package load takes a ZarfPackageConfig, composes imports, and validates the con
|
Package load takes a ZarfPackageConfig, composes imports, and validates the con |