contextfn

package
v2.4.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package contextfn implements an in-process composition function that the CLI hosts to inject and capture pipeline context for `crossplane render`. It replaces the previous function-go-templating based approach so the CLI no longer depends on an external function image for context handling.

Index

Constants

View Source
const FunctionName = "crossplane-render-context"

FunctionName is the pkgv1.Function.Name used for the in-process context function. It is exported because callers must key the FunctionInput address map with it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle struct {
	// Target is the gRPC target that dials the function. Set this as the
	// FunctionInput address passed to the render engine.
	Target string
	// contains filtered or unexported fields
}

Handle is the owner of a running in-process context function.

func Start

func Start(ctx context.Context, log logging.Logger, contextData map[string]any) (*Handle, error)

Start starts an in-process gRPC server that implements the composition function RunFunction RPC for context seeding and capture. The server listens on a unix-domain socket inside a fresh temp directory. Callers must call Handle.Stop when done.

func (*Handle) Captured

func (h *Handle) Captured() *structpb.Struct

Captured returns the context observed by the capture step, or nil if capture did not run.

func (*Handle) CompositeCaptureStep

func (h *Handle) CompositeCaptureStep() apiextensionsv1.PipelineStep

CompositeCaptureStep returns a Composition pipeline step that captures the end-of-pipeline context into the handle. Append it to a Composition pipeline.

func (*Handle) CompositeSeedStep

func (h *Handle) CompositeSeedStep() apiextensionsv1.PipelineStep

CompositeSeedStep returns a Composition pipeline step that seeds the pipeline context from the handle's context data. Prepend it to a Composition pipeline.

func (*Handle) Function

func (h *Handle) Function() pkgv1.Function

Function returns the Function definition the caller must add to the render engine's functions list so the in-process context function is known by name.

func (*Handle) OperationCaptureStep

func (h *Handle) OperationCaptureStep() opsv1alpha1.PipelineStep

OperationCaptureStep is the Operation pipeline equivalent of CompositeCaptureStep.

func (*Handle) OperationSeedStep

func (h *Handle) OperationSeedStep() opsv1alpha1.PipelineStep

OperationSeedStep is the Operation pipeline equivalent of CompositeSeedStep.

func (*Handle) Stop

func (h *Handle) Stop()

Stop gracefully stops the function server and removes the socket directory. Safe to call multiple times.

Jump to

Keyboard shortcuts

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