Documentation
¶
Overview ¶
Package module defines the Module and ModuleMetadata types, mirroring the #Module definition in the CUE catalog (v1alpha1). A Module represents the parsed module definition before it is built into a release.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// Metadata is the module metadata extracted from the module definition.
Metadata *ModuleMetadata `json:"metadata"`
// Config is the #config schema from the module definition (#Module.#config).
// It defines the constraints and defaults for module values.
Config cue.Value `json:"#config,omitempty"`
// Raw is the fully evaluated CUE value for the module.
Raw cue.Value
// ModulePath is the local filesystem directory path to the module.
ModulePath string
}
Module represents the #Module type before it is built.
type ModuleMetadata ¶
type ModuleMetadata struct {
// Name is the canonical module name from module.metadata.name (kebab-case).
Name string `json:"name"`
// Description is a brief description of the module.
Description string `json:"description,omitempty"`
// ModulePath is the CUE registry module path from metadata.modulePath.
// This is the registry path (e.g., "opmodel.dev/modules"), NOT a filesystem path.
ModulePath string `json:"modulePath"`
// DefaultNamespace is the default namespace from the module definition.
DefaultNamespace string `json:"defaultNamespace"`
// FQN is the fully qualified module name (modulePath/name:version).
// Example: "opmodel.dev/modules/my-app:1.0.0"
FQN string `json:"fqn"`
// Version is the module version (semver).
Version string `json:"version"`
// UUID is the module identity UUID (from #Module.metadata.identity).
UUID string `json:"uuid"`
// Labels from the module definition (pre-build, author-declared).
Labels map[string]string `json:"labels,omitempty"`
// Annotations from the module definition.
Annotations map[string]string `json:"annotations,omitempty"`
}
ModuleMetadata contains module-level identity and version information. This is the module's canonical metadata, distinct from the release it is deployed as.
type Release ¶
type Release struct {
// Metadata is the decoded release identity from the concrete release spec.
Metadata *ReleaseMetadata
// Module is the original module used to prepare the release.
Module Module
// Spec is the concrete, values-filled #ModuleRelease CUE value.
// Concrete (all regular fields resolved) but NOT finalized — CUE definition
// fields (#resources, #traits, #blueprints) are preserved. Required by
// MatchComponents() for component-transformer matching.
// MUST NOT be passed to FinalizeValue or v.Syntax(cue.Final()).
Spec cue.Value
// Values is the concrete, merged values applied to the release.
Values cue.Value
}
Release is a fully prepared module release ready for rendering. When a *Release exists, all invariants hold: Spec is concrete and complete, Values is concrete and merged, Metadata is decoded.
func ParseModuleRelease ¶
func ParseModuleRelease(_ context.Context, spec cue.Value, mod Module, values []cue.Value) (*Release, error)
ParseModuleRelease validates values, fills them into the release spec, ensures the result is concrete, decodes metadata, and constructs Release.
func (*Release) MatchComponents ¶
MatchComponents returns the schema-preserving components value used for matching. The returned value keeps definition fields such as #resources, #traits, and #blueprints.
type ReleaseMetadata ¶
type ReleaseMetadata struct {
// Name is the release name (from --name or module.metadata.name).
Name string `json:"name"`
// Namespace is the target namespace.
Namespace string `json:"namespace"`
// UUID is the release identity UUID.
// Computed by CUE as SHA1(OPMNamespace, moduleUUID:name:namespace).
UUID string `json:"uuid"`
// Labels are the merged release labels (module labels + standard opm labels).
Labels map[string]string `json:"labels,omitempty"`
// Annotations are the merged release annotations.
Annotations map[string]string `json:"annotations,omitempty"`
}
ReleaseMetadata contains release-level identity information. Used for K8s inventory tracking, resource labeling, and CLI output.