Documentation
¶
Index ¶
- Variables
- 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 = errors.New("invalid OPM package") // ErrWrongKind marks a package whose concrete kind does not match the // artifact the loader was asked for. ErrWrongKind = errors.New("wrong OPM artifact kind") // ErrMissingRequiredField marks a package missing a required identity // field, or carrying it in non-concrete form. ErrMissingRequiredField = errors.New("missing required field") )
Sentinel errors returned by the package loaders' shape gate. Each Load*Package wraps the relevant sentinel via %w so frontends (CLI, controller, Crossplane function) can branch on the failure class with errors.Is rather than string matching.
Functions ¶
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.