Documentation
¶
Overview ¶
Package mirror discovers container images and Helm charts referenced by a recipe and emits the list in formats consumable by air-gap tools (Hauler, Zarf) and general-purpose formats (JSON, YAML).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KubeVersionFromConstraints ¶
func KubeVersionFromConstraints(constraints []recipe.Constraint) string
KubeVersionFromConstraints extracts a concrete Kubernetes version from the recipe's K8s.server.version constraint. The constraint value is typically a semver range like ">= 1.32.4"; this function extracts the version digits so it can be passed to `helm template --kube-version`. Returns defaults.MirrorDefaultKubeVersion if no constraint is found.
func Render ¶
func Render(w io.Writer, list *MirrorList, format Format) error
Render writes the MirrorList to w in the given format.
func SupportedFormats ¶
func SupportedFormats() []string
SupportedFormats returns the list of valid format strings for shell completion and usage text.
Types ¶
type ChartRef ¶
type ChartRef struct {
// Name is the component name that references this chart.
Name string `json:"name" yaml:"name"`
// Repository is the Helm repository URL (oci:// or https://).
Repository string `json:"repository" yaml:"repository"`
// Chart is the Helm chart name.
Chart string `json:"chart" yaml:"chart"`
// Version is the pinned chart version.
Version string `json:"version" yaml:"version"`
// Namespace is the target Kubernetes namespace.
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}
ChartRef describes a Helm chart artifact needed by the recipe.
type ComponentImages ¶
type ComponentImages struct {
// Component is the component name.
Component string `json:"component" yaml:"component"`
// Type is the component type ("helm" or "kustomize").
Type string `json:"type" yaml:"type"`
// Images is the sorted, deduplicated list of container images.
Images []string `json:"images" yaml:"images"`
// Warnings contains non-fatal issues encountered during discovery
// (e.g., helm template render warnings).
Warnings []string `json:"warnings,omitempty" yaml:"warnings,omitempty"`
}
ComponentImages groups discovered images by the component that references them.
type Format ¶
type Format string
Format enumerates the output formats mirror list supports.
const ( // FormatYAML renders the discovery result as YAML (default). FormatYAML Format = "yaml" // FormatJSON renders the discovery result as JSON. FormatJSON Format = "json" // FormatHauler renders a Hauler manifest (content.hauler.cattle.io/v1). FormatHauler Format = "hauler" // FormatZarf renders a Zarf package config (ZarfPackageConfig). FormatZarf Format = "zarf" )
type Lister ¶
type Lister struct {
// contains filtered or unexported fields
}
Lister discovers container images and Helm charts from a recipe.
func (*Lister) Discover ¶
func (l *Lister) Discover(ctx context.Context, rec *recipe.RecipeResult) (*MirrorList, error)
Discover takes a loaded RecipeResult and returns a MirrorList by rendering each component's chart and extracting images.
Manifest and component-values reads both route through the recipe's bound DataProvider (rec.DataProvider()), so a recipe built against a `--data` overlay sees overlay-provided manifests and values consistently. When the recipe carries no bound provider, reads fall back to the package-global embedded provider inside recipe.GetManifestContentWithContext.
type MirrorList ¶
type MirrorList struct {
// Images is the global sorted, deduplicated set of container images.
Images []string `json:"images" yaml:"images"`
// Charts is the list of Helm charts referenced by the recipe.
Charts []ChartRef `json:"charts" yaml:"charts"`
// Components is the per-component image breakdown (for detailed output).
Components []ComponentImages `json:"components" yaml:"components"`
// Metadata carries recipe provenance for traceability.
Metadata MirrorListMetadata `json:"metadata" yaml:"metadata"`
}
MirrorList is the discovery result containing all container images and Helm charts referenced by a recipe. It is the serialization-ready payload for json/yaml formats and the input to format-specific renderers (Hauler, Zarf).
type MirrorListMetadata ¶
type MirrorListMetadata struct {
// RecipeVersion is the CLI version that generated the recipe.
RecipeVersion string `json:"recipeVersion,omitempty" yaml:"recipeVersion,omitempty"`
// Criteria is a human-readable summary of the recipe criteria.
Criteria string `json:"criteria,omitempty" yaml:"criteria,omitempty"`
}
MirrorListMetadata carries recipe provenance.
type Option ¶
type Option func(*Lister)
Option configures a Lister.
func WithHelmRenderer ¶
WithHelmRenderer sets a custom renderer (used in tests to inject canned YAML without requiring the helm binary).
func WithKubeVersion ¶
WithKubeVersion sets the Kubernetes version passed to `helm template --kube-version`. If unset, defaults.MirrorDefaultKubeVersion is used.
func WithValueOverrides ¶
func WithValueOverrides(overrides []config.ComponentPath) Option
WithValueOverrides sets component value overrides that affect which images appear in rendered charts.