function

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Overview

Package function is the Crossplane v2 composition-function edge adapter for cuefn. It translates a RunFunctionRequest into the curated inputs the pure render.Engine core consumes, then translates the engine's result back into desired composed resources, a patched composite status, and a success condition on the response.

All Crossplane request/response and gRPC proto types live here, at the edge. The render core stays free of them: this package depends on the core only through the render.ModuleLoader port, supplied by a LoaderFactory seam so the serve command wires an OCI loader while tests drive a local one offline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Function

type Function struct {
	fnv1.UnimplementedFunctionRunnerServiceServer
	// contains filtered or unexported fields
}

Function is the cuefn composition function. It renders desired composed resources from a CUE module evaluated against the observed XR and the pipeline environment.

func New

func New(newLoader LoaderFactory, log logging.Logger) *Function

New returns a Function that builds its module loader with newLoader and logs through log.

func (*Function) RunFunction

RunFunction decodes the step Input, builds the engine inputs from the observed XR and the pipeline environment, renders the named module, and writes the resulting composed resources, composite status, and a success condition onto the response.

Every malformed or unreachable input path returns a single FATAL result whose message names the cause and returns (rsp, nil): the function never panics and never returns a transport error for a domain failure, so Crossplane surfaces the cause on the composite instead of retrying a doomed gRPC call.

type LoaderFactory

type LoaderFactory func(in *v1beta1.Input) (render.ModuleLoader, error)

LoaderFactory builds the render.ModuleLoader used to fetch the module named in a step's Input. It is the seam between the adapter and the core's loading port: the serve command supplies an OCI-backed factory (OCILoaderFactory), while tests supply one returning a render.LocalLoader so they run offline. It receives the decoded Input so a factory can fold per-step settings (such as ExpectedDigest) into the loader it returns.

func OCILoaderFactory

func OCILoaderFactory(base render.OCIConfig) LoaderFactory

OCILoaderFactory returns a LoaderFactory that builds a render.OCILoader from base, folding the Input's ExpectedDigest into the loader's per-ref digest expectation so a step can lock a module to a specific manifest. The base config carries process-level settings (cache dir, CUE_REGISTRY via Env); the returned factory clones it per request so concurrent steps never share an Expect map.

Jump to

Keyboard shortcuts

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