expander

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveredPath

type DiscoveredPath struct {
	// Path relative to BaseDir (or the repo root if BaseDir is empty).
	Path string
	// BaseDir is the root directory for Path resolution.
	// If empty, Path is resolved against the main repo root.
	BaseDir string
	// Namespace overrides the namespace for all namespace-scoped resources
	// rendered from this path (e.g. Flux Kustomization spec.targetNamespace).
	Namespace string
	// Producer describes the Flux object or path that caused this path to be rendered.
	Producer string
	// Substitutions contains Flux postBuild inline substitutions for this path.
	Substitutions map[string]string
}

DiscoveredPath represents a path to render, optionally relative to a different base directory (e.g. a cloned GitRepository).

type DiscoveryRunner

type DiscoveryRunner struct {
	Expanders     *Registry
	PathKey       PathKeyFunc
	RenderPath    RenderPathFunc
	MaxIterations int
}

DiscoveryRunner repeatedly renders discovered paths and expands the resulting resource set until Flux discovery reaches a fixed point.

func (DiscoveryRunner) Run

func (r DiscoveryRunner) Run(ctx context.Context, resources *render.Render, initial []DiscoveredPath) (*ExpandResult, error)

Run renders initial and discovered paths, accumulating non-fatal expansion errors.

type ExpandResult

type ExpandResult struct {
	// Resources contains additional resources produced by the expander.
	Resources resmap.ResMap
	// DiscoveredPaths contains new paths that should be rendered.
	DiscoveredPaths []DiscoveredPath
	// Errors contains non-fatal errors encountered during expansion
	// (e.g. a HelmRelease whose chart could not be resolved).
	// These do not stop expansion but should be surfaced to the user.
	Errors []error
	// DeferredErrors contains unresolved dependencies that may be discovered in
	// later iterations. Expanders must recompute these on every call; discovery
	// promotes only those remaining at the fixed point to Errors.
	DeferredErrors []error
}

ExpandResult holds the output of an expander.

type Expander

type Expander interface {
	Expand(ctx context.Context, r *render.Render) (*ExpandResult, error)
}

Expander is the interface that each resource expander must implement.

type PathKeyFunc

type PathKeyFunc func(DiscoveredPath) string

PathKeyFunc returns the stable identity used to deduplicate discovered paths.

type Registry

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

Registry holds a collection of expanders and runs them in order.

func NewRegistry

func NewRegistry(log logr.Logger) *Registry

NewRegistry creates a new empty expander registry.

func (*Registry) Expand

func (r *Registry) Expand(ctx context.Context, render *render.Render) (*ExpandResult, error)

Expand runs all registered expanders and accumulates results.

func (*Registry) Register

func (r *Registry) Register(e Expander)

Register adds an expander to the registry.

type RenderPathFunc

type RenderPathFunc func(DiscoveredPath) error

RenderPathFunc renders one discovered path into the current resource set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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