chainexec

package
v0.0.0-...-3669a39 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package chainexec executes ConfigHub FunctionChain and validator groups against config data. It's the shared core consumed by `installer render` (after template resolution) and by `installer transformer` (which receives already-resolved groups from a KRM ResourceList functionConfig). Template resolution itself lives in internal/render — it depends on installer state that's irrelevant to the kustomize-side caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatValidatorFailures

func FormatValidatorFailures(failures []ValidatorFailure) string

FormatValidatorFailures renders a list of failures as a multi-line error message suitable for the operator. Empty slice → empty string.

func ParseFunctionArguments

func ParseFunctionArguments(args []string) ([]fapi.FunctionArgument, error)

ParseFunctionArguments converts cub-CLI-shaped arg strings into the FunctionArgument form the executor expects. An arg of the form `--name=value` becomes a named argument with ParameterName=name; a bare arg becomes a positional argument with Value=<arg>.

Mirrors the parser in public/cmd/cub/function_do.go so chain templates can use the same `--liveness-path=/internal/ok` style as worker_install.go.

func RunChain

func RunChain(ctx context.Context, chain *api.FunctionChain, input []byte) ([]byte, error)

RunChain executes the resolved FunctionChain against the input YAML stream. Each group fires one FunctionInvocationRequest; the response's ConfigData feeds the next group. Mirrors invokeLocalFunctions in cub's worker_install.

Types

type ValidatorFailure

type ValidatorFailure struct {
	Group        int
	FunctionName string
	UnitSlug     string
	Details      []string
}

ValidatorFailure is one failing validation result. Returned by RunValidators; formatted into operator-facing error messages via FormatValidatorFailures.

func RunValidators

func RunValidators(ctx context.Context, groups []api.FunctionGroup, data []byte) ([]ValidatorFailure, error)

RunValidators executes validator groups against data. Each group is invoked with StopOnError=false so every validator runs and the operator sees a complete report. Returns nil on full success.

Validators must be Validating functions (Mutating=false). Mutating functions in the validators list are rejected before any invocation runs — the validators list is a contract, not a generic chain.

Jump to

Keyboard shortcuts

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