kustomization

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package kustomization reconciles Flux Kustomizations: wait on dependsOn / sourceRef / structural parent, resolve postBuild substitutions, run the kustomize SDK, parse the result back into the Store, and publish a KustomizationArtifact. Failures bubble up to the orchestrator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	*base.Controller

	// Staging is a process-wide cache that materializes source roots
	// into writable copies so Flux's Generator can write the merged
	// kustomization.yaml without touching the user's working tree.
	Staging *kustomize.StagingCache

	// WipeSecrets controls whether Secret cleartext is wiped when
	// parsing rendered manifests.
	WipeSecrets bool
	// contains filtered or unexported fields
}

Controller orchestrates Kustomization reconciliation. Reconcile- shaping state (Filter, ParentOf) flows in via Configure exactly once before Start. The invariant — "config is read-only after Start" — is encoded in the embedded *base.Controller, not just in code review.

func New

func New(s *store.Store, t *task.Service, staging *kustomize.StagingCache, wipeSecrets bool) *Controller

New constructs a Kustomization controller.

func (*Controller) Configure

func (c *Controller) Configure(opts Options)

Configure installs the post-bootstrap state. Panics if called after Start — encodes the invariant that reconcile-shaping config is read-only once the controller is dispatching.

func (*Controller) Start

func (c *Controller) Start(ctx context.Context)

Start registers the listener that drives reconciliation.

type Options

type Options struct {
	Filter        *change.Filter
	ParentOf      func(manifest.NamedResource) (manifest.NamedResource, bool)
	RenderTracker base.RenderTracker
	// Existence is the file-existence lookup the orchestrator wires
	// against the loader's ExistenceIndex. depwait uses it to lazy-
	// promote file-indexed deps and to distinguish render-only
	// deps from typo'd ones at the missing-dep grace boundary. See
	// depwait.ExistenceLookup for the decision matrix. Forwarded
	// to every Waiter built during reconcile.
	Existence depwait.ExistenceLookup
	// Renders is the quiescence signal the orchestrator wires
	// against task.Service.ActiveCount. depwait's step-2 long wait
	// short-circuits to "dependency not found" once Renders reports
	// no other reconcile is in flight — so a typo'd dependsOn
	// fails as soon as the orchestrator drains instead of burning
	// the full RenderProducingTimeout cap.
	Renders depwait.RenderInflight
	// PreflightFailure reports dependency-graph errors discovered by the
	// orchestrator before reconcile. When set for an id, the controller
	// marks the resource Failed and does not render it.
	PreflightFailure func(manifest.NamedResource) (string, bool)
	// SelfProduces reports whether consumer's OWN render emits cm. When
	// it does, collectDeps drops cm from the dependency set — a KS can't
	// hard-wait on a postBuild.substituteFrom ConfigMap that only its own
	// render produces (the bjw-s/onedr0p self-substitute). Available in
	// full mode (graph-aware index), unlike the changed-only producer
	// skip. Nil → the edge is always added (pre-index behavior).
	SelfProduces func(cm, consumer manifest.NamedResource) bool
}

Options carries the post-bootstrap state the orchestrator wires onto the controller before Start. Filter narrows reconciliation to changed resources in changed-only mode. ParentOf maps each Flux Kustomization to its structural parent so reconcile waits for the parent's Ready before rendering (so any parent-render-time spec mutations — e.g. `replacements:` injecting spec.targetNamespace — are observable when the child renders). A nil ParentOf disables parent-enforcement, matching pre-#102 behavior. RenderTracker receives every reconcilable child this KS emits during render.

Jump to

Keyboard shortcuts

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