Documentation
¶
Overview ¶
Package render executes matched transforms and decodes rendered resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComponentSummary ¶
type ComponentSummary struct {
// Name is the component name.
Name string
// Labels are the component-level labels from metadata.labels.
// Example: {"core.opmodel.dev/workload-type": "stateless"}
Labels map[string]string
// ResourceFQNs are the FQNs of resource types declared by the component.
// Sorted for deterministic output.
// Example: ["opmodel.dev/opm/v1alpha1/resources/workload/container@v1"]
ResourceFQNs []string
// TraitFQNs are the FQNs of traits declared by the component.
// Sorted for deterministic output.
// Example: ["opmodel.dev/opm/v1alpha1/traits/network/expose@v1"]
TraitFQNs []string
}
ComponentSummary contains display-oriented summary data extracted from a component after the render pipeline. It captures the key properties useful for verbose output without exposing cue.Value fields.
type MatchPlan ¶
type MatchPlan struct {
Matches map[string]map[string]MatchResult
Unmatched []string
UnhandledTraits map[string][]string
}
func Match ¶
Match compares each component against all transformers in the provider, returning a MatchPlan that details which transformers matched which components and what was missing for non-matches. It also identifies any traits present in components that are not handled by any matched transformer, which will be ignored in rendering and should be surfaced as warnings to the user.
func (*MatchPlan) MatchedPairs ¶
func (p *MatchPlan) MatchedPairs() []MatchedPair
MatchedPairs returns all matched component-transformer pairs, sorted by component name and then transformer FQN.
func (*MatchPlan) NonMatchedPairs ¶
func (p *MatchPlan) NonMatchedPairs() []NonMatchedPair
NonMatchedPairs returns all non-matched component-transformer pairs with missing labels, resources, and traits. Sorted by component name then transformer FQN.
type MatchResult ¶
type MatchedPair ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module drives the OPM render pipeline for a single ModuleRelease.
A Module is constructed once per provider and reused across multiple Execute calls. It is not safe for concurrent use (CUE context is single-threaded).
func (*Module) Execute ¶
func (r *Module) Execute( ctx context.Context, rel *module.Release, schemaComponents cue.Value, dataComponents cue.Value, plan *MatchPlan, ) (*ModuleResult, error)
Execute runs matched transformers against the provided component views and returns rendered resources, component summaries, and warnings.
schemaComponents is the non-finalized components value (from rel.MatchComponents()) preserving CUE definition fields needed for metadata extraction. dataComponents is the finalized, constraint-free components value for FillPath injection.
type ModuleResult ¶
type ModuleResult struct {
// Resources is the ordered list of rendered Kubernetes resources.
// Each resource carries Component and Transformer provenance for inventory tracking.
Resources []*core.Resource
// MatchPlan is the decoded result of matching components against transformers.
// Nil if matching was not performed (e.g. no components).
MatchPlan *MatchPlan
// Components is a per-component summary for verbose output, sorted by name.
Components []ComponentSummary
// Warnings is a list of human-readable advisory messages (e.g. unhandled traits).
// A non-empty Warnings slice does NOT indicate failure.
Warnings []string
}
ModuleResult holds the output of a successful Execute call.
func ProcessModuleRelease ¶
func ProcessModuleRelease( ctx context.Context, rel *module.Release, p *provider.Provider, runtimeName string, ) (*ModuleResult, error)
ProcessModuleRelease renders a prepared release with the given provider. The release must already be fully prepared via module.ParseModuleRelease. If runtimeName is non-empty, it overrides the default runtime identity injected into each transformer's #context.#runtimeName during execution.
type NonMatchedPair ¶
type UnmatchedComponentsError ¶
type UnmatchedComponentsError struct {
// Components is the list of component names with no matching transformer.
Components []string
// Matches is the full match result matrix, used to build per-component diagnostics.
Matches map[string]map[string]MatchResult
}
UnmatchedComponentsError is returned when one or more components have no matching transformer. It includes per-component diagnostics listing which transformers were evaluated and what was missing (labels, resources, traits).
Each unmatched component is surfaced as a *oerrors.TransformError via Unwrap(), enabling callers to use errors.As for typed handling of individual failures.
func (*UnmatchedComponentsError) Error ¶
func (e *UnmatchedComponentsError) Error() string
func (*UnmatchedComponentsError) Unwrap ¶
func (e *UnmatchedComponentsError) Unwrap() []error
Unwrap returns a slice of *oerrors.TransformError — one per unmatched component — so that callers can use errors.As to extract per-component failure details.
Each TransformError carries the component name and the first non-matching transformer FQN. Its Cause is a plain terminal error describing the failure, not a nested UnmatchedComponentsError, to prevent infinite recursion when errors.As traverses the chain.