kustomize

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 49 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kustomize wraps sigs.k8s.io/kustomize/api so the rest of flate never invokes the `kustomize` CLI. It provides:

  • Render: return unstamped output from disk inputs through Flux's secure FS, or immutable source artifacts through their authoritative fs.FS. Generated files use one private overlay; artifact labels need not exist on disk.
  • Prepare: the standard pre-render dance (Clone + expand postBuild.substituteFrom + authored inline values) for embedders rendering a single Kustomization. Symmetric to helm.Prepare for HelmReleases, minus a values cache; the substituteFrom path has no YAML parse to memoize; see Prepare's docstring.
  • Substitute: envsubst-style "${VAR}" / "${VAR:=default}" used for Flux post-build substitutions.

Concurrency. Each Render call builds against its own private overlay, so no two renders share mutable state and there is no per-tree build lock. krusty's package-global state (the openapi schema registry, builtin plugin/transformer factories) is still not goroutine-safe, so the process-wide internal/engine/kustomize/krusty.BuildMutex serializes EVERY krusty invocation flate runs, including the helm post-renderer's krusty.Run in internal/engine/helm. fluxcd/pkg/kustomize guards its own Build for the same reason; every flate-owned krusty entrypoint MUST hold that same mutex.

Render persists unstamped output with its input read-set snapshot and validates that snapshot against the source view before reusing a frame.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdaptSelector

func AdaptSelector(selector *fluxapis.Selector) *kustypes.Selector

AdaptSelector converts a Flux selector into a kustomize selector. Mirrors flux's generator adaptSelector (nil in, nil out).

func ApplySourceIgnore

func ApplySourceIgnore(ks *manifest.Kustomization, source *store.SourceArtifact) bool

ApplySourceIgnore preserves source-controller filtering for ordinary acquired content.

func Prepare

func Prepare(
	ks *manifest.Kustomization,
	inputs []values.Result,
) (*manifest.Kustomization, error)

Prepare clones ks and resolves referenced and inline substitutions.

func Render

Render returns unstamped renderer documents from an admitted source and a private overlay. Generated files never mutate the source. Cancellation is checked around the upstream build, which does not accept a context.

func RenderInputs

func RenderInputs(receipt *manifest.RenderReceipt) map[string]bool

RenderInputs returns source-relative observed paths and whether each read excludes descendants.

func SourceInput

func SourceInput(reads sourceReader, ks *manifest.Kustomization) (*store.SourceArtifact, bool, error)

SourceInput resolves the ordinary Kustomization source and local ignore policy.

func Substitute

func Substitute(data []byte, vars map[string]string, strict bool) ([]byte, error)

Substitute expands data with Flux's envsubst engine. Strict mode rejects undefined variables without defaults; otherwise they expand to empty strings.

Types

type EntryEvidence

type EntryEvidence struct {
	Producer    manifest.NamedResource                                      `json:"Producer"`
	Application map[string]any                                              `json:"Application"`
	Root        manifest.NamedResource                                      `json:"Root"`
	Owner       manifest.NamedResource                                      `json:"Owner"`
	Records     iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord] `json:"Records"`
	Receipt     *manifest.RenderReceipt                                     `json:"Receipt"`
	Inputs      []EntryInput                                                `json:"Inputs"`
	Renders     []*manifest.RenderReceipt                                   `json:"Renders"`
}

EntryEvidence retains the accepted producer inventory that qualified an entry application.

type EntryInput

type EntryInput struct {
	Resource manifest.NamedResource `json:"Resource"`
	Content  string                 `json:"Content"`
	Binding  store.ArtifactInput    `json:"Binding"`
	Artifact *store.SourceArtifact  `json:"-"`
	Data     manifest.Data          `json:"-"`
}

EntryInput binds one resolved qualification input to owner-derived content.

type GitBaseFetcher

GitBaseFetcher acquires an immutable repository view for private render mounts.

type GitBaseRequest

type GitBaseRequest struct {
	Work       manifest.WorkScope `json:"-"`
	URL        string             `json:"URL"`
	Ref        string             `json:"Ref"`
	MaxAge     time.Duration      `json:"MaxAge"`
	Timeout    time.Duration      `json:"Timeout"`
	Submodules bool               `json:"Submodules"`
}

GitBaseRequest carries effective Git policy and the referencing Flux interval.

type Preparation

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

Preparation MUST remain owned by one logical render consumer until transfer or retirement.

func (*Preparation) Matches

func (p *Preparation) Matches(cache *TreeCache, request *RenderRequest) bool

Matches MUST NOT grant publication authority or validate current source bytes.

type RenderRequest

type RenderRequest struct {
	Preparation *Preparation `json:"-"`
	// Work borrows stage counters from this render execution.
	Work *manifest.RenderWork `json:"-"`
	// HeldSlot is TreeCache's borrowed service when this render holds its slot.
	// Standalone callers leave it nil.
	HeldSlot *task.Service `json:"HeldSlot"`
	// Source.FS supplies content; nil Source or FS is unavailable.
	// Empty Source.Content denotes mutable content validated on every cache hit.
	Source *store.SourceArtifact `json:"Source"`
	// ApplyIgnore selects source-controller exclusions for admitted local aliases.
	ApplyIgnore bool `json:"ApplyIgnore"`
	// Label mounts source content in kyaml; empty uses Source.LocalPath.
	Label string `json:"Label"`
	// SubPath selects the source directory to build.
	SubPath string `json:"SubPath"`
	// Spec is the prepared Flux Kustomization; nil builds without a Flux owner.
	Spec                    *manifest.Kustomization       `json:"Spec"`
	SubstitutionActive      bool                          `json:"SubstitutionActive"`
	UnreadableSubstitutions map[string]manifest.Reference `json:"-"`

	// StrictSubstitutions binds undefined-variable handling to accepted history.
	StrictSubstitutions bool `json:"StrictSubstitutions"`
	// SkipKinds binds the effective emitted-kind policy to accepted history.
	SkipKinds []string `json:"SkipKinds"`
}

RenderRequest carries the authoritative source and its mount label. Label is metadata and need not name an existing host path.

type ShapeOptions

type ShapeOptions struct {
	Strict bool
	Work   *manifest.WorkRecord
}

ShapeOptions supplies substitution policy and its physical work counter.

type Shaping

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

Shaping owns private documents and temporary YAML for one render attempt.

func PrepareShape

func PrepareShape(request *RenderRequest, docs []manifest.DocOccurrence) *Shaping

PrepareShape MUST retain raw identity separately from sanitized application content.

func (*Shaping) Apply

func (p *Shaping) Apply(_ context.Context, options ShapeOptions) error

Apply MUST retain every document failure while returning the first substitution error.

func (*Shaping) Content

func (p *Shaping) Content() any

Content preserves the raw identity after Apply mutates the private documents.

func (*Shaping) Retire

func (p *Shaping) Retire()

Retire releases prepared YAML after application or a deduplicated attempt.

type TreeCache

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

TreeCache borrows backing storage and HTTP inputs for one run's render state. Callers MUST join renders and Close before releasing borrowed dependencies.

func NewTreeCache

func NewTreeCache(owner *cache.Cache, remoteInputs *source.HTTPInputs, tasks *task.Service) *TreeCache

NewTreeCache borrows the nonnil storage owner, HTTP inputs and task service.

func (*TreeCache) ApplicationReceipt

func (c *TreeCache) ApplicationReceipt(
	ctx context.Context,
	request RenderRequest,
	evidence EntryEvidence,
	files []string,
) (EntryEvidence, error)

ApplicationReceipt captures complete local and resolved entry qualification inputs.

func (*TreeCache) Close

func (c *TreeCache) Close()

Close clears render state after callers join renders; borrowed inputs stay open.

func (*TreeCache) EntryValid

func (*TreeCache) EntryValid(ctx context.Context, evidence EntryEvidence, st *store.Store) bool

EntryValid qualifies provisional evidence against current resolved input content.

func (*TreeCache) PreviousEntry

func (c *TreeCache) PreviousEntry(ctx context.Context, req RenderRequest) EntryEvidence

PreviousEntry MUST treat persisted evidence as provisional until current inputs qualify it.

func (*TreeCache) PreviousRender

func (c *TreeCache) PreviousRender(
	ctx context.Context,
	req RenderRequest,
) ([]manifest.DocOccurrence, *manifest.RenderReceipt, bool)

PreviousRender returns validated raw output without rendering or acquiring remote inputs.

func (*TreeCache) RecordEntry

func (c *TreeCache) RecordEntry(ctx context.Context, receipt *manifest.RenderReceipt, reads *store.ReadSet) error

RecordEntry MUST publish only complete evidence with current captured inputs.

func (*TreeCache) RenderHistory

RenderHistory returns complete accepted inventory matching the current final inputs.

func (*TreeCache) SetGitBaseFetcher

func (c *TreeCache) SetGitBaseFetcher(fn GitBaseFetcher)

SetGitBaseFetcher wires the git-clone capability used to resolve remote git bases referenced from a kustomization's resources:. The orchestrator calls this once at construction; library/test embedders may leave it unset.

Directories

Path Synopsis
Package krusty coordinates access to krusty's process-global schema and plugins.
Package krusty coordinates access to krusty's process-global schema and plugins.
Package kustomizeinput classifies Kustomize's direct file and configuration inputs.
Package kustomizeinput classifies Kustomize's direct file and configuration inputs.

Jump to

Keyboard shortcuts

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