discovery

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package discovery hydrates the store, resolves local source identities, and publishes immutable discovery records, ownership claims and resource-graph readers. Source aliasing uses authored URL/ref values before parent rendering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admission added in v0.7.3

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

Admission retains immutable bootstrap policy for early and runtime source decisions.

func (*Admission) AcceptEntry added in v0.7.3

func (a *Admission) AcceptEntry(ctx context.Context, binding Binding) (Binding, error)

AcceptEntry installs only a proposal whose original support remains current.

func (*Admission) AddApplication added in v0.7.3

func (a *Admission) AddApplication(_ *store.Store, obj manifest.BaseManifest)

AddApplication MUST only record arrivals because store listeners cannot perform qualification.

func (*Admission) AddHistory added in v0.7.3

func (a *Admission) AddHistory(_ *store.Store, id manifest.NamedResource, record manifest.DiscoveryRecord)

AddHistory MUST qualify historical declarations against current parent authority.

func (*Admission) BindEntry added in v0.7.3

func (a *Admission) BindEntry(ctx context.Context, st *store.Store) (*manifest.Kustomization, Binding, error)

BindEntry proposals MUST pass loader admission before AcceptEntry.

func (*Admission) EntryProducers added in v0.7.3

func (a *Admission) EntryProducers() []manifest.NamedResource

EntryProducers MUST expose only the pending ordered prefix.

func (*Admission) Resolve added in v0.7.3

Resolve admits a known source or a missing Git bootstrap reference. A nil artifact leaves normal acquisition responsible for the source.

type Binding added in v0.7.3

type Binding struct {
	Producer, Source, Key manifest.NamedResource
	Path                  string
	Failure               error
	Entry                 *kustomize.EntryEvidence
	Reads                 *store.ReadSet
	// contains filtered or unexported fields
}

Binding keeps actual ownership separate from the paired entry comparison coordinate.

type Config

type Config struct {
	Cache *cache.Cache
	Work  manifest.WorkScope
	// Projections shares source-free facts across concurrent Plan calls.
	Projections *manifest.ProducerProjections
	// Declarations contains immutable invocation references admitted before discovery.
	Declarations []store.Declaration
	// Selection controls restricted declaration construction.
	Selection selection.Request
	Changes   *change.Set
	// Loader borrows the invocation's sole declaration loader.
	Loader *loader.Loader

	// Input is authoritative over a preseeded bootstrap artifact or disk admission.
	Input *store.SourceArtifact
	// Entry supplies immutable parsed input prepared by Plan for this admission.
	Entry *Entry
	// Path is the scan entry point, defaulting to the admitted input's LocalPath.
	// Relative paths resolve against the working directory.
	Path string
	// RepoRoot is the source root that Kustomization spec.path values
	// resolve against (the GitRepository artifact root). Supplied
	// explicitly by SDK consumers rendering extracted trees that have no
	// .git. Without an admitted bootstrap input, an empty value selects
	// the repository containing Path or Path itself. A preseeded
	// input retains its own coordinate. Path must sit at or under RepoRoot.
	RepoRoot string
	// SelfURLs are the remote URL(s) this tree represents. A user-authored
	// GitRepository matching one is the cluster pulling itself: no ref or
	// HEAD uses the working tree, another local ref uses a cached committed
	// artifact, and unavailable refs or non-HEAD sparse/submodule options
	// warn and fetch normally. SDK consumers supply these for extracted
	// trees with no .git/config; empty uses the working tree's git remotes.
	SelfURLs []string
	// KRMIgnoreFile, when non-empty, is read in place of <Path>/.krmignore
	// for the initial scan; spec.path targets followed afterwards keep
	// their own per-directory .krmignore. Lets one checkout carry several
	// scan scopes (e.g. .krmignore.staging / .krmignore.production) and
	// pick one per run.
	KRMIgnoreFile string
	// Trees is required when discovered packages need a bare Kustomize build.
	Trees               *kustomize.TreeCache
	Store               *store.Store
	RemoteInputs        *source.HTTPInputs
	RemoteRetry         cache.RetryConfig
	StrictSubstitutions bool
	SkipKinds           []string
	// contains filtered or unexported fields
}

Config is the input contract for Run. Store is mandatory.

type Entry added in v0.7.3

type Entry struct {
	ID    manifest.ClusterID
	Path  string
	Input *store.SourceArtifact
	// contains filtered or unexported fields
}

Entry keeps structural identity separate from the path used for admission.

func Plan added in v0.7.3

func Plan(ctx context.Context, cfg Config) ([]Entry, error)

Plan must partition the scan before any entry publishes seeds into the caller's store.

type Result

type Result struct {
	Binding   Binding    // Admission applies the same immutable bootstrap policy to runtime source identities.
	Admission *Admission // RepoRoot is the bootstrap input's ownership coordinate. Admitted
	// inputs may use a synthetic label with no corresponding directory.
	RepoRoot                string // Index contains the immutable static discovery facts consumed by rendering.
	Index                   *manifest.DiscoveryIndex
	DependencySubstitutions values.DependencySubstitutions
	// contains filtered or unexported fields
}

Result summarizes what discovery hydrated into the store.

func Run

func Run(ctx context.Context, cfg Config) (*Result, error)

Run performs the full discovery phase against cfg and writes results into cfg.Store. Returns the structural metadata the orchestrator needs for change-filter construction and controller wiring.

func (*Result) Close added in v0.7.3

func (r *Result) Close()

Close MUST follow task drain and every possible construction consumer.

func (*Result) TakePreparation added in v0.7.3

func (r *Result) TakePreparation(
	cache *kustomize.TreeCache,
	request *kustomize.RenderRequest,
	destination *kustomize.Preparation,
) bool

TakePreparation MUST run only on the matching owner after construction freezes.

type Session added in v0.7.3

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

Session retains invocation-local declaration construction until Freeze.

func Begin added in v0.7.3

func Begin(ctx context.Context, cfg Config) (*Session, error)

Begin binds sources and collects declarations without evaluating standalone packages.

func (*Session) Admission added in v0.7.3

func (d *Session) Admission() *Admission

Admission borrows the canonical entry owner before and after Freeze.

func (*Session) Advance added in v0.7.3

func (d *Session) Advance(ctx context.Context, admission *selection.Admission) (bool, error)

Advance prepares source-qualified declarations and packages required by admission.

func (*Session) Close added in v0.7.3

func (d *Session) Close()

Close MUST also cover construction failure before a Result exists.

func (*Session) Freeze added in v0.7.3

func (d *Session) Freeze(ctx context.Context) (*Result, error)

Freeze publishes the final index once and releases construction ownership.

Jump to

Keyboard shortcuts

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