Documentation
¶
Index ¶
- Variables
- func BuildReleaseOverlay(ctx *cue.Context, root string, overlay map[string]load.Source, ...) (cue.Value, error)
- func LoadModulePackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)
- func LoadPlatformPackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)
- func LoadReleasePackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)
- type LoadOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidPackage marks a structurally invalid package: the built root // is not a struct, or load.Instances did not resolve exactly one instance. ErrInvalidPackage = shape.ErrInvalidPackage // ErrWrongKind marks a package whose concrete kind does not match the // artifact the loader was asked for. ErrWrongKind = shape.ErrWrongKind // ErrMissingRequiredField marks a package missing a required identity // field, or carrying it in non-concrete form. ErrMissingRequiredField = shape.ErrMissingRequiredField )
The module shape gate is single-sourced in opm/helper/loader/internal/shape so that loader/file and loader/registry validate artifacts identically. The sentinels are re-exported here with unchanged identity: existing errors.Is(err, file.ErrWrongKind) callers keep working because these are the same error values the shared gate wraps. See shape for the gate itself.
Functions ¶
func BuildReleaseOverlay ¶ added in v0.6.0
func BuildReleaseOverlay(ctx *cue.Context, root string, overlay map[string]load.Source, opts LoadOptions) (cue.Value, error)
BuildReleaseOverlay evaluates an in-memory #ModuleRelease package supplied as a load.Source overlay rooted at root, running the same build-and-shape-gate step LoadReleasePackage applies to on-disk release packages. It is the entry point synth.Release uses to evaluate the virtual package it synthesizes (a fabricated cue.mod/module.cue + release.cue + values.cue) as a single CUE build, so synthesized and authored releases share one evaluation path.
The shape gate (shape.ReleaseSpec) is single-sourced in opm/helper/loader/internal/shape and unreachable from outside the loader tree; this exported wrapper lets the synth helper reuse it without naming the internal spec type. opts.Registry, when non-empty, overrides CUE_REGISTRY via load.Config.Env (never os.Setenv), so it is safe under concurrency.
func LoadModulePackage ¶
LoadModulePackage loads a module CUE package from a directory and returns the raw cue.Value. Used by callers (e.g. opm module vet) to load a module for validation or rendering.
LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the module's transitive imports (transformers, traits, sub-modules) resolve from the override registry without mutating process state.
The recommended entry point is Kernel.LoadModulePackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.
func LoadPlatformPackage ¶
LoadPlatformPackage loads a #Platform CUE package from a directory and returns the raw cue.Value. Mirrors LoadModulePackage and LoadReleasePackage: every .cue file in dirPath that shares the package is unified into a single instance, so the platform is identified by its CUE package clause rather than a platform.cue filename.
LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the platform's transitive imports resolve from the override registry without mutating process state.
The recommended entry point is Kernel.LoadPlatformPackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.
func LoadReleasePackage ¶
LoadReleasePackage loads a #ModuleRelease CUE package from a directory and returns the raw cue.Value. Mirrors LoadModulePackage: every .cue file in dirPath that shares the package is unified into a single instance, so authors can split a release across release.cue, values.cue, and overlay files within one CUE package.
LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the release's module imports resolve from the override registry without mutating process state.
The recommended entry point is Kernel.LoadReleasePackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.
Types ¶
type LoadOptions ¶
type LoadOptions struct {
// Registry overrides the CUE_REGISTRY value used while loading. Empty
// means use the current process environment.
//
// The override is applied via load.Config.Env, NOT os.Setenv, so the
// loader is safe to call concurrently from a long-running service
// (Crossplane function, REST API, embedded SDK).
Registry string
}
LoadOptions configures package-loader behavior shared by LoadModulePackage, LoadReleasePackage, and LoadPlatformPackage.