load

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package load takes a ZarfPackageConfig, composes imports, and validates the con

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComponentConfig added in v0.85.0

func ComponentConfig(path string) (v1beta1.ComponentConfig, error)

ComponentConfig reads and schema-validates a v1beta1 ZarfComponentConfig file.

func ComponentDefinition added in v0.88.0

func ComponentDefinition(ctx context.Context, componentPath string, opts ComponentOptions) (v1beta1.ComponentConfig, error)

ComponentDefinition returns a structurally validated component config after imports are resolved. It does not read component resource contents or values files.

func HasActionSet added in v0.87.0

func HasActionSet(actions v1beta1.ComponentActionSet) bool

HasActionSet reports whether an action set contains actions or defaults.

func PackageDefinition

func PackageDefinition(ctx context.Context, packagePath string, opts DefinitionOptions) (api.Package, error)

PackageDefinition returns a structurally validated package definition after flavors, imports, and set variables are applied. It does not read package resource contents; callers that need values, schemas, charts, or manifests must use load.Package.

func ValidateRemoteKustomizeRestrictions added in v0.87.0

func ValidateRemoteKustomizeRestrictions(spec v1beta1.ComponentSpec) error

ValidateRemoteKustomizeRestrictions rejects unrestricted Kustomize builds for remote components.

Types

type ComponentConfigImportResolution added in v0.85.0

type ComponentConfigImportResolution struct {
	Component       v1beta1.ComponentConfig
	ImportedSchemas []string
	// contains filtered or unexported fields
}

ComponentConfigImportResolution contains a component config with imports resolved and the imported values schema paths needed to preserve schema precedence during publication.

func ResolveComponentConfigImports added in v0.85.0

func ResolveComponentConfigImports(ctx context.Context, component v1beta1.ComponentConfig, componentPath string, remoteOptions types.RemoteOptions, cachePath string) (ComponentConfigImportResolution, error)

ResolveComponentConfigImports resolves imports in a v1beta1 component config using the supplied registry options and cache path for remote component imports, then validates the resolved component.

func (ComponentConfigImportResolution) MaterializeResources added in v0.85.0

func (r ComponentConfigImportResolution) MaterializeResources(ctx context.Context, componentPath string) (*ResourceSet, error)

MaterializeResources makes remote component resources available on the filesystem while publishing a resolved component config. The caller must close the returned resource set.

type ComponentOptions added in v0.88.0

type ComponentOptions struct {
	// CachePath stores remote component layers locally when non-empty.
	CachePath string
	// SkipValuesSchemaValidation skips validating merged values against the
	// resolved schema. Schema parsing and merging still occur.
	SkipValuesSchemaValidation bool
	types.RemoteOptions
}

ComponentOptions configures component loading.

type DefinitionHeader added in v0.88.0

type DefinitionHeader struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
}

DefinitionHeader identifies the API version and kind declared by a config file.

func ParseDefinitionHeader added in v0.88.0

func ParseDefinitionHeader(contents []byte) (DefinitionHeader, error)

ParseDefinitionHeader reads the identifying fields without loading the full definition.

type DefinitionOptions

type DefinitionOptions struct {
	// Architecture overrides package metadata. Empty falls back to metadata, then the host.
	Architecture string
	Flavor       string
	SetVariables map[string]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
	// SkipVersionCheck skips version requirement validation
	SkipVersionCheck bool
	types.RemoteOptions
}

DefinitionOptions are the optional parameters to load.Package.

type PackageOptions added in v0.85.0

type PackageOptions struct {
	DefinitionOptions
	// SkipValuesSchemaValidation skips validating merged values against the
	// resolved schema. Schema parsing and merging still occur.
	SkipValuesSchemaValidation bool
}

PackageOptions configures resource-ready package loading.

type ResolvedComponent added in v0.88.0

type ResolvedComponent struct {
	Definition   v1beta1.ComponentConfig
	Resources    *ResourceSet
	Values       value.Values
	ValuesSchema value.SchemaDocument
}

ResolvedComponent is a component config with its imports, resources, and values loaded. Call Close when resource access is no longer needed.

func Component added in v0.88.0

func Component(ctx context.Context, componentPath string, opts ComponentOptions) (_ *ResolvedComponent, err error)

Component loads a v1beta1 component config and makes imported resources available.

func (*ResolvedComponent) Close added in v0.88.0

func (c *ResolvedComponent) Close() error

Close removes temporary resources materialized while loading the component.

type ResolvedPackage added in v0.84.0

type ResolvedPackage struct {
	Definition   api.Package
	Resources    *ResourceSet
	Values       value.Values
	ValuesSchema value.SchemaDocument
}

ResolvedPackage is a package definition together with its source resources and package values. Call Close when resource access is no longer needed.

func Package added in v0.85.0

func Package(ctx context.Context, packagePath string, opts PackageOptions) (_ *ResolvedPackage, err error)

Package resolves a package definition and makes imported component resources available without assembling a Zarf package.

func (*ResolvedPackage) Close added in v0.85.0

func (p *ResolvedPackage) Close() error

Close removes temporary resources materialized while loading the package.

type ResourceSet added in v0.85.0

type ResourceSet struct {
	// contains filtered or unexported fields
}

ResourceSet maps logical paths in a package definition to filesystem paths. It keeps temporary imported-component resources private to the package load.

func NewResourceSet added in v0.85.0

func NewResourceSet(root string) *ResourceSet

NewResourceSet creates a resource set rooted at a local component or package directory.

func (*ResourceSet) Close added in v0.85.0

func (r *ResourceSet) Close() error

Close removes temporary remote-component resources.

func (*ResourceSet) Path added in v0.85.0

func (r *ResourceSet) Path(logicalPath string) (string, error)

Path returns the physical path for a local or materialized remote resource. URLs are intentionally not resource-set paths and must be handled by their owning resource type.

func (*ResourceSet) ReadFile added in v0.85.0

func (r *ResourceSet) ReadFile(logicalPath string) ([]byte, error)

ReadFile reads an exact resource file.

func (*ResourceSet) Root added in v0.85.0

func (r *ResourceSet) Root() (string, error)

Root returns the original package source directory.

Jump to

Keyboard shortcuts

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